/// <summary> /// Ensures that an object with the specified name exists, while creating other properties are set to their default values /// </summary> /// <param name="i_sName">Name</param> /// <returns>cEmpProfessionalDetail object</returns> public static cEmpProfessionalDetail CreateIfRequiredAndGet(string i_sName) { cEmpProfessionalDetail oObj = cEmpProfessionalDetail.Get_Name(i_sName); if (oObj == null) { oObj = cEmpProfessionalDetail.Create(); oObj.sName = i_sName; oObj.Save(); } return(oObj); }
public ActionResult EmpProfessional() { string Professional = Request.QueryString["Professional"]; List <EmpProfessionalDetails> list = Newtonsoft.Json.JsonConvert.DeserializeObject <List <EmpProfessionalDetails> >(Professional); int LoginId = Convert.ToInt32(HttpContext.User.Identity.Name); for (var i = 0; i < list.Count; i++) { cEmpProfessionalDetail objEudCreate = cEmpProfessionalDetail.Create(); objEudCreate.sCompanyName = list[i].CompanyName; objEudCreate.sDesignation = list[i].Designation; DateTime dt1 = list[i].FromDate; DateTime dt2 = list[i].EndDate; objEudCreate.dtFromDate = Convert.ToDateTime(dt1); objEudCreate.dtEndDate = Convert.ToDateTime(dt2); objEudCreate.objEmpLogin.iObjectID = LoginId; objEudCreate.Save(); } TempData["Prof"] = 1; return(RedirectToAction("Profile")); }