public static RoomSalesModel EntityToModel(this RoomSales entity, bool virtualActive = false)
        {
            try
            {
                RoomSalesModel model = new RoomSalesModel()
                {
                    Amount = entity.Amount,
                    DiscountsId = entity.DiscountsId,
                    LoginDate = entity.LoginDate,
                    LogoutDate = entity.LogoutDate,
                    PacketId = entity.PacketId,
                    RoomId = entity.RoomId,
                    SalesId = entity.SalesId,
                    IsActive = entity.IsActive,
                    Id = entity.Id
                };
                if (virtualActive)
                {
                    model.Discount = entity.Discount;
                    model.Packet = entity.Packet;
                    model.Room = entity.Room;
                    model.Sale = entity.Sale;
                    model.SaleExtras = entity.SaleExtras;
                    model.StayingInRooms = entity.StayingInRooms;

                }
                return model;
            }
            catch (Exception)
            {

                return new RoomSalesModel();
            }
        }
 public ActionResult RoomSalesInsert(RoomSalesModel model)
 {
     if (_serviceRoomSales.Insert(model.ModelToEnity())>0)
     {
         return RedirectToAction("RoomSalesCustomerInsert", "Sale", new {id = model.Id});
     }
     else
     {
         return RedirectToAction("RoomSalesInsert", "Sale",new { id=model.Id });
     }
 }
 public ActionResult RoomSalesEdit(RoomSalesModel model)
 {
     int sayi= _serviceRoomSales.Update(model.ModelToEnity());
        return RedirectToAction("RoomSalesEdit","Sale",new {id=model.Id});
 }
 public ActionResult RoomSalesDetails(int id)
 {
     var rezervasyon= _serviceRoomSales.GetById(id);
        RoomSalesModel model = new RoomSalesModel
        {
        Amount = rezervasyon.Amount,
        Discount = rezervasyon.Discount,
        DiscountsId = rezervasyon.DiscountsId,
        Id = rezervasyon.Id,
        LoginDate = rezervasyon.LoginDate,
        LogoutDate = rezervasyon.LogoutDate,
        Packet = rezervasyon.Packet,
        PacketId = rezervasyon.PacketId,
        Room = rezervasyon.Room,
        RoomId = rezervasyon.RoomId,
        Sale = rezervasyon.Sale,
        SalesId = rezervasyon.SalesId
        };
     return View(model);
 }