public bool Delete_Htl_BranchDeals(int dealId, int userId) { Htl_BranchDeals result = ent.Htl_BranchDeals.Where(x => x.BranchDealId == dealId).FirstOrDefault(); ent.DeleteObject(result); ent.SaveChanges(); return(true); }
public int Save_Htl_BranchDeals(BranchDealViewModel model) { Htl_BranchDeals objToSave = new Htl_BranchDeals(); objToSave.BranchDealMasterId = model.DealMasterId; objToSave.HotelId = model.HotelId; objToSave.Amount = Convert.ToDouble(model.Amount); objToSave.isPercentage = model.isPercentage; objToSave.CreatedBy = model.CreatedBy; objToSave.CreatedDate = DateTime.Now; entity.AddToHtl_BranchDeals(objToSave); entity.SaveChanges(); return(objToSave.BranchDealId); }
public bool Update_Htl_BranchDeals(BranchDealViewModel model) { Htl_BranchDeals objToUpdate = new Htl_BranchDeals(); objToUpdate = ent.Htl_BranchDeals.Where(x => x.BranchDealId == model.DealId).FirstOrDefault(); objToUpdate.BranchDealMasterId = model.DealMasterId; objToUpdate.HotelId = model.HotelId; objToUpdate.Amount = Convert.ToDouble(model.Amount); objToUpdate.isPercentage = model.isPercentage; objToUpdate.UpdateBy = model.UpdatedBy; objToUpdate.UpdatedDate = model.UpdatedDate; ent.ApplyCurrentValues(objToUpdate.EntityKey.EntitySetName, objToUpdate); ent.SaveChanges(); return(true); }