public LeadQuestionOption UpdateLeadQuestionOption(LeadQuestionOption objLeadQuestionOption) { try { objLeadQuestionOption.updateDate = DateTime.Now; using (var context = new FitnessCenterEntities()) { context.LeadQuestionOptions.Attach(context.LeadQuestionOptions.Single(varL => varL.ID == objLeadQuestionOption.ID)); context.LeadQuestionOptions.ApplyCurrentValues(objLeadQuestionOption); context.SaveChanges(); return(objLeadQuestionOption); } } catch (Exception ex) { throw ex; } }
public LeadQuestionOption InsertLeadQuestionOption(LeadQuestionOption objLeadQuestionOption) { try { objLeadQuestionOption.insertDate = DateTime.Now; objLeadQuestionOption.isDeleted = false; using (var context = new FitnessCenterEntities()) { context.LeadQuestionOptions.AddObject(objLeadQuestionOption); context.SaveChanges(); return(objLeadQuestionOption); } } catch (Exception ex) { throw ex; } }