public LeadQuestionAnswer UpdateLeadQuestionAnswer(LeadQuestionAnswer objLeadQuestionAnswer) { try { objLeadQuestionAnswer.updateDate = DateTime.Now; using (var context = new FitnessCenterEntities()) { context.LeadQuestionAnswers.Attach(context.LeadQuestionAnswers.Single(varL => varL.ID == objLeadQuestionAnswer.ID)); context.LeadQuestionAnswers.ApplyCurrentValues(objLeadQuestionAnswer); context.SaveChanges(); return(objLeadQuestionAnswer); } } catch (Exception ex) { throw ex; } }
public LeadQuestionAnswer InsertLeadQuestionAnswer(LeadQuestionAnswer objLeadQuestionAnswer) { try { objLeadQuestionAnswer.insertDate = DateTime.Now; objLeadQuestionAnswer.isActive = true; objLeadQuestionAnswer.isDeleted = false; using (var context = new FitnessCenterEntities()) { context.LeadQuestionAnswers.AddObject(objLeadQuestionAnswer); context.SaveChanges(); return(objLeadQuestionAnswer); } } catch (Exception ex) { throw ex; } }