public LeadPresentation UpdateLeadPresentation(LeadPresentation objLeadPresentation) { try { objLeadPresentation.updateDate = DateTime.Now; using (var context = new FitnessCenterEntities()) { context.LeadPresentations.Attach(context.LeadPresentations.Single(varL => varL.ID == objLeadPresentation.ID)); context.LeadPresentations.ApplyCurrentValues(objLeadPresentation); context.SaveChanges(); return(objLeadPresentation); } } catch (Exception ex) { throw ex; } }
public LeadPresentation InsertLeadPresentation(LeadPresentation objLeadPresentation) { try { objLeadPresentation.insertDate = DateTime.Now; objLeadPresentation.isActive = true; objLeadPresentation.isDeleted = false; using (var context = new FitnessCenterEntities()) { context.LeadPresentations.AddObject(objLeadPresentation); context.SaveChanges(); return(objLeadPresentation); } } catch (Exception ex) { throw ex; } }