/// <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>cExternalProjectHead object</returns> public static cExternalProjectHead CreateIfRequiredAndGet(string i_sName) { cExternalProjectHead oObj = cExternalProjectHead.Get_Name(i_sName); if (oObj == null) { oObj = cExternalProjectHead.Create(); oObj.sName = i_sName; oObj.Save(); } return(oObj); }
public JsonResult AddExternalHead(Externalhead head) { try { cExternalProjectHead ExtHead = cExternalProjectHead.Create(); ExtHead.sName = head.Name; ExtHead.sEmailID = head.Email; ExtHead.sContactNo = head.Contact; ExtHead.objClient.iObjectID = Convert.ToInt32(head.SelectedExternalClient[0]); ExtHead.bIsActive = true; ExtHead.Save(); head.ExternalClientList = getIClientList(); ViewBag.DataSaved = "External head added successfully"; return(Json("1")); } catch (Exception ex) { throw ex; } }