MGroupProfile populateProfile(MUIGroupProfile profile) { MGroupProfile mRetVal = new MGroupProfile(); mRetVal.Name = profile.Name; mRetVal.Description = profile.Description; mRetVal.Id = profile.Id; mRetVal.SecurityEntityId = SecurityEntityUtility.CurrentProfile().Id; return(mRetVal); }
public IHttpActionResult Save(MUIGroupProfile profile) { if (profile == null) { throw new ArgumentNullException("uiProfile", "uiProfile cannot be a null reference (Nothing in Visual Basic)!"); } string mRetVal = "false"; MGroupProfile mProfileToSave = new MGroupProfile(); MSecurityInfo mSecurityInfo = new MSecurityInfo(FunctionUtility.GetProfile(ConfigSettings.GetAppSettingValue("Actions_EditGroups", true)), AccountUtility.CurrentProfile()); Logger mLog = Logger.Instance(); if (HttpContext.Current.Items["EditId"] != null) { if (profile.Id == -1) { if (!mSecurityInfo.MayAdd) { Exception mError = new Exception("The account (" + AccountUtility.CurrentProfile().Account + ") being used does not have the correct permissions to add"); mLog.Error(mError); return(this.InternalServerError(mError)); } mProfileToSave.AddedBy = AccountUtility.CurrentProfile().Id; mProfileToSave.AddedDate = DateTime.Now; } else { if (!mSecurityInfo.MayAdd) { Exception mError = new Exception("The account (" + AccountUtility.CurrentProfile().Account + ") being used does not have the correct permissions to edit"); mLog.Error(mError); return(this.InternalServerError(mError)); } //mProfileToSave = RoleUtility.GetProfile(profile.Id); mProfileToSave.UpdatedBy = AccountUtility.CurrentProfile().Id; mProfileToSave.UpdatedDate = DateTime.Now; } } mProfileToSave = populateProfile(profile); GroupUtility.Save(mProfileToSave); return(Ok(mRetVal)); }