// GET: Competency public Competency AddEditComp(Competency comp) { using (var context = new SSITrainingEntities()) { try { var result = context.sp_CACompetency_AddEditCompetency(comp.CompetencyID, comp.CompetencyGroupID, comp.Question, comp.Answer, comp.CompetencyTypeID, comp.LevelID, Convert.ToInt32(Session["USERID"])); if (comp.CompetencyID == 0) //if this is true, then this is a Competency Insert, otherwise, it's an edit. { comp.CompetencyID = Convert.ToInt32(result); comp.CreateUserID = Convert.ToInt32(Session["USERID"]); } } catch (Exception ex) { } return(comp); } }