NotesWhat is notes.io?

Notes brand slogan

Notes - notes.io

using DataLayer;
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.ServiceModel;
using System.Text;
using System.Threading.Tasks;
using System.Drawing;

namespace BusinessLayer
{
[ServiceBehavior(InstanceContextMode= InstanceContextMode.Single)]

public class AllBusiness : IAllRepository
{

public List<City> ListCity()
{
using (var db = new TrivagoDBEntities())
return db.Citys.ToList();
}

public City GetCitys(string id)
{
using(var db = new TrivagoDBEntities())
{
var cityId = Convert.ToInt32(id);
return db.Citys.FirstOrDefault(x => x.CityId == cityId);
}
}

public List<Town> ListTown()
{
using (var db = new TrivagoDBEntities())
return db.Towns.ToList();
}

public List<Town> ListTownByCity(string ID)
{
using(TrivagoDBEntities db = new TrivagoDBEntities())
{
return db.Towns.Where(c => c.CityId == Convert.ToInt32(ID)).ToList();
}
}

public Town GetTowns(string id)
{
using(var db = new TrivagoDBEntities())
{
var townId = Convert.ToInt32(id);
return db.Towns.FirstOrDefault(x => x.TownId == townId);
}
}

public List<HotelFeature> ListHotelFeature()
{
using (var db = new TrivagoDBEntities())
return db.HotelFeatures.ToList();
}

public HotelFeature GetHotelFeatures(string id)
{
using(var db = new TrivagoDBEntities())
{
var hotelFeatures = Convert.ToInt32(id);
return db.HotelFeatures.FirstOrDefault(x => x.HT_Id == hotelFeatures);
}
}

public List<Hotel> ListHotel()
{
using (var db = new TrivagoDBEntities())
return db.Hotels.ToList();
}

public void AddHotel(string HotelName, string HotelImageFileName, string HotelImage, string HotelPrice, string HotelLatitude, string HotelLongitude, string HotelWebSite, string RT_Id, string CityId, string TownId, string HT_Id, string UserId)
{
using (var db = new TrivagoDBEntities())
{
var hotel = new Hotel
{
HotelName = HotelName,
HotelImageFileName = HotelImageFileName,
HotelPrice = Convert.ToInt32(HotelPrice),
HotelLatitude = HotelLatitude,
HotelLongitude = HotelLongitude,
HotelWebSite = HotelWebSite,
RT_Id = Convert.ToInt32(RT_Id),
CityId = Convert.ToInt32(CityId),
TownId = Convert.ToInt32(TownId),
HT_Id = Convert.ToInt32(HT_Id),
UserId = Convert.ToInt32(UserId)
};
db.Hotels.Add(hotel);
db.SaveChanges();

}
}

public void RemoveHotel(string id)
{
using(var db = new TrivagoDBEntities())
{
var hotelId = Convert.ToInt32(id);
var hotel = db.Hotels.FirstOrDefault(x => x.HotelId == hotelId);
if (hotel == null) return;
db.Hotels.Remove(hotel);
db.SaveChanges();
}
}

public void UpdateHotel(string Id, string HotelName, string HotelImageFileName, string HotelImage, string HotelPrice, string HotelLatitude, string HotelLongitude, string HotelWebSite, string RT_Id, string CityId, string TownId, string HT_Id, string UserId)
{
using (var db = new TrivagoDBEntities())
{
var hotelId = Convert.ToInt32(Id);
var hotel = db.Hotels.FirstOrDefault(x => x.HotelId == hotelId);
if (hotel == null) return;
hotel.HotelName = HotelName;
hotel.HotelImageFileName = HotelImageFileName;
hotel.HotelPrice = Convert.ToInt32(HotelPrice);
hotel.HotelWebSite = HotelWebSite;
hotel.HotelLatitude = HotelLatitude;
hotel.HotelLongitude = HotelLongitude;
hotel.RT_Id = Convert.ToInt32(RT_Id);
hotel.CityId = Convert.ToInt32(CityId);
hotel.TownId = Convert.ToInt32(TownId);
hotel.HT_Id = Convert.ToInt32(HT_Id);
hotel.UserId = Convert.ToInt32(UserId);
db.Entry(hotel).State = System.Data.Entity.EntityState.Modified;
db.SaveChanges();
}
}

public Hotel GetHotels(string id)
{
using (var db = new TrivagoDBEntities())
{
var hotelId = Convert.ToInt32(id);
return db.Hotels.FirstOrDefault(x => x.HotelId == hotelId);
}
}

public List<RoomType> ListRoomType()
{
using (var db = new TrivagoDBEntities())
return db.RoomTypes.ToList();
}

public RoomType GetRoomTypes(string id)
{
using (var db = new TrivagoDBEntities())
{
var RT_Id = Convert.ToInt32(id);
return db.RoomTypes.FirstOrDefault(x => x.RT_Id == RT_Id);

}
}

public List<User> ListUser()
{
using (var db = new TrivagoDBEntities())
return db.Users.ToList();
}

public void AddUser(string Username, string Userpassword, string UserFirstSurname, string UserTelephone, string Useremail)
{
using (var db = new TrivagoDBEntities())
{
var User = new User
{
UserName = Username,
UserPassword = Userpassword,
UserFirstSurname = UserFirstSurname,
UserTelephone = UserTelephone,
UserEmail = Useremail
};
db.Users.Add(User);
db.SaveChanges();

}
}

public void RemoveUser(string id)
{
using (var db = new TrivagoDBEntities())
{
var userId = Convert.ToInt32(id);
var user = db.Users.FirstOrDefault(x => x.UserId == userId);
if (user == null) return;
db.Users.Remove(user);
db.SaveChanges();
}
}

public void UpdateUser(string Username, string Userpassword, string UserFirstSurname, string UserTelephone, string Useremail, string id)
{
using (var db = new TrivagoDBEntities())
{
var userId = Convert.ToInt32(id);
var user = db.Users.FirstOrDefault(x => x.UserId == userId);
if (user == null) return;
user.UserName = Username;
user.UserPassword = Userpassword;
user.UserFirstSurname = UserFirstSurname;
user.UserTelephone = UserTelephone;
user.UserEmail = Useremail;
db.Entry(user).State = System.Data.Entity.EntityState.Modified;
db.SaveChanges();

}
}

public User GetUsers(string id)
{
using (var db = new TrivagoDBEntities())
{
var userId = Convert.ToInt32(id);
return db.Users.FirstOrDefault(x => x.UserId == userId);

}
}

public List<Reserved> ListReserved()
{
using (var db = new TrivagoDBEntities())
return db.Reserveds.ToList();
}

public void AddReserved(string HotelId, string RT_Id, string UserId, DateTime DateofEntry, DateTime ReleaseDate, string TotalPrice)
{
using (var db = new TrivagoDBEntities())
{
var Reserved = new Reserved
{
HotelId = Convert.ToInt32(HotelId),
RT_Id = Convert.ToInt32(RT_Id),
DateofEntry = Convert.ToDateTime(DateofEntry),
ReleaseDate = Convert.ToDateTime(ReleaseDate),
TotalPrice = Convert.ToInt32(TotalPrice)
};
db.Reserveds.Add(Reserved);
db.SaveChanges();

}
}

public void RemoveReserved(string id)
{
using (var db = new TrivagoDBEntities())
{
var reservedId = Convert.ToInt32(id);
var reserved = db.Reserveds.FirstOrDefault(x => x.ReserveId == reservedId);
if (reservedId == null) return;
db.Reserveds.Remove(reserved);
db.SaveChanges();
}
}

public void UpdateReserved(string HotelId, string RT_Id, string UserId, DateTime DateofEntry, DateTime ReleaseDate, string TotalPrice, string id)
{
using (var db = new TrivagoDBEntities())
{
var reservedId = Convert.ToInt32(id);
var reserved = db.Reserveds.FirstOrDefault(x => x.ReserveId == reservedId);
if (reserved == null) return;
reserved.HotelId = Convert.ToInt32(HotelId);
reserved.RT_Id = Convert.ToInt32(RT_Id);
reserved.UserId = Convert.ToInt32(UserId);
reserved.DateofEntry = Convert.ToDateTime(DateofEntry);
reserved.ReleaseDate = Convert.ToDateTime(ReleaseDate);
reserved.TotalPrice = Convert.ToInt32(TotalPrice);
db.Entry(reserved).State = System.Data.Entity.EntityState.Modified;
db.SaveChanges();
}
}

public Reserved GetReserved(string id)
{
using (var db = new TrivagoDBEntities())
{
var reservedId = Convert.ToInt32(id);
return db.Reserveds.FirstOrDefault(x => x.ReserveId == reservedId);

}
}
}
}
     
 
what is notes.io
 

Notes.io is a web-based application for taking notes. You can take your notes and share with others people. If you like taking long notes, notes.io is designed for you. To date, over 8,000,000,000 notes created and continuing...

With notes.io;

  • * You can take a note from anywhere and any device with internet connection.
  • * You can share the notes in social platforms (YouTube, Facebook, Twitter, instagram etc.).
  • * You can quickly share your contents without website, blog and e-mail.
  • * You don't need to create any Account to share a note. As you wish you can use quick, easy and best shortened notes with sms, websites, e-mail, or messaging services (WhatsApp, iMessage, Telegram, Signal).
  • * Notes.io has fabulous infrastructure design for a short link and allows you to share the note as an easy and understandable link.

Fast: Notes.io is built for speed and performance. You can take a notes quickly and browse your archive.

Easy: Notes.io doesn’t require installation. Just write and share note!

Short: Notes.io’s url just 8 character. You’ll get shorten link of your note when you want to share. (Ex: notes.io/q )

Free: Notes.io works for 12 years and has been free since the day it was started.


You immediately create your first note and start sharing with the ones you wish. If you want to contact us, you can use the following communication channels;


Email: [email protected]

Twitter: http://twitter.com/notesio

Instagram: http://instagram.com/notes.io

Facebook: http://facebook.com/notesio



Regards;
Notes.io Team

     
 
Shortened Note Link
 
 
Looding Image
 
     
 
Long File
 
 

For written notes was greater than 18KB Unable to shorten.

To be smaller than 18KB, please organize your notes, or sign in.