/// <summary> /// Method to insert to the Profile recognition /// </summary> /// <param name="model"></param> /// <returns></returns> public bool Save(ProfileRecognition model) { bool save = true; try { using (LBCData context = new LBCData(ConnectionHelper.getConnectionString())) { LBC_PROFILE_RECOGNITION _profileM = new LBC_PROFILE_RECOGNITION() { CREATED_DATE = model.CREATED_DATE, CREATED_BY = model.CREATED_BY, RECOGNITION_ID = model.RECOGNITION_ID, STARS_ID = model.STARS_ID, STATUS = model.STATUS }; context.LBC_PROFILE_RECOGNITION.Add(_profileM); context.SaveChanges(); } } catch (Exception ex) { throw ex; // save = false; } return(save); }
public bool Update(ProfileRecognition model) { bool save = true; try { using (LBCData context = new LBCData(ConnectionHelper.getConnectionString())) { var _profile = (from p in context.LBC_PROFILE_RECOGNITION where p.STARS_ID == model.STARS_ID && p.RECOGNITION_ID == model.RECOGNITION_ID select p).FirstOrDefault(); _profile.STATUS = model.STATUS; // _profile.RECOGNITION_ID = model.RECOGNITION_ID; _profile.UPDATE_DATE = model.UPDATE_DATE; _profile.UPDATED_BY = model.UPDATED_BY; context.SaveChanges(); } } catch (Exception ex) { throw ex; // save = false; } return(save); }
/// <summary> /// Update the data when the entry already exist /// </summary> /// <param name="model"></param> /// <returns></returns> public bool Update(ProfileRecognition model) { ProfileRecognitionRepository _profileR = new ProfileRecognitionRepository(); return(_profileR.Update(model)); }
public ActionResult SaveProfileUserAdmin(ProfileModel model, FormCollection frm) { ProfileBL profile = new ProfileBL(); ProfileRecognitionBL _recog = new ProfileRecognitionBL(); ProfileRecognition _modelpr = new ProfileRecognition(); ProfileRecognitionMasterBL _recogmaster = new ProfileRecognitionMasterBL(); if (!string.IsNullOrEmpty(model.mobile1) && !string.IsNullOrEmpty(model.mobile2) && !string.IsNullOrEmpty(model.mobile3)) { if (model.mobile1.Length + model.mobile2.Length + model.mobile3.Length == 10) { model.PHONE = model.mobile1 + model.mobile2 + model.mobile3; } else { model.PHONE = null; } } else { model.PHONE = null; model.mobile1 = null; model.mobile2 = null; model.mobile3 = null; } model.UPDATED_BY = System.Web.HttpContext.Current.Session["w_user"].ToString(); profile.UpdateProfileByStarsIdAdmin(model); List <ProfileRecognition> lst = new List <ProfileRecognition>(); lst = _recog.GetRecognitionByStarsId(model.STARS_ID); List <ProfileRecognitionMasterModel> lstmaster = new List <ProfileRecognitionMasterModel>(); lstmaster = _recogmaster.GetAll(); if (lst.Count > 0) { for (int i = 1; i <= lstmaster.Count; i++) { _modelpr.STATUS = frm.GetValue("" + i + "").AttemptedValue;//frm[""+i+""].ToString().GEt _modelpr.UPDATE_DATE = DateTime.Now; _modelpr.UPDATED_BY = model.WSLX_ID; _modelpr.STARS_ID = model.STARS_ID; _modelpr.RECOGNITION_ID = i; _recog.Update(_modelpr); } } else { for (int i = 1; i <= lstmaster.Count; i++) { _modelpr.STATUS = frm.GetValue("" + i + "").AttemptedValue; _modelpr.CREATED_DATE = DateTime.Now; _modelpr.STARS_ID = model.STARS_ID; _modelpr.RECOGNITION_ID = i; _modelpr.CREATED_BY = model.WSLX_ID; _recog.Save(_modelpr); } } // String i = frm["1"].ToString(); return(RedirectToAction("LBCProfile", new { ID = model.STARS_ID })); }