public bool Delete_Htl_DistributorDeals(int dealId, int userId) { Htl_DistributorDeals result = ent.Htl_DistributorDeals.Where(x => x.DistributorDealId == dealId).FirstOrDefault(); ent.DeleteObject(result); ent.SaveChanges(); return(true); }
public int Save_Htl_DistributorDeals(BranchDealViewModel model) { Htl_DistributorDeals objToSave = new Htl_DistributorDeals(); objToSave.DistributorDealMasterId = 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_DistributorDeals(objToSave); entity.SaveChanges(); return(objToSave.DistributorDealId); }
public bool Update_Htl_DistributorDeals(BranchDealViewModel model) { Htl_DistributorDeals objToUpdate = new Htl_DistributorDeals(); objToUpdate = ent.Htl_DistributorDeals.Where(x => x.DistributorDealId == model.DealId).FirstOrDefault(); objToUpdate.DistributorDealMasterId = 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); }