public DtoActionResult AddImageProfileScript(EntityImageProfileScript imageProfileScript) { _uow.ImageProfileScriptRepository.Insert(imageProfileScript); _uow.Save(); var actionResult = new DtoActionResult(); actionResult.Success = true; actionResult.Id = imageProfileScript.Id; return(actionResult); }
protected void btnUpdate_Click(object sender, EventArgs e) { var deleteResult = Call.ImageProfileApi.RemoveProfileScripts(ImageProfile.Id); var checkedCount = 0; foreach (GridViewRow row in gvScripts.Rows) { var runWhen = (DropDownList)row.FindControl("ddlRunWhen"); if (runWhen.Text == "Disabled") { continue; } checkedCount++; var dataKey = gvScripts.DataKeys[row.RowIndex]; if (dataKey == null) { continue; } var profileScript = new EntityImageProfileScript { ScriptModuleId = Convert.ToInt32(dataKey.Value), ProfileId = ImageProfile.Id, RunWhen = (EnumProfileScript.RunWhen)Enum.Parse(typeof(EnumProfileScript.RunWhen), runWhen.SelectedValue) }; var txtPriority = row.FindControl("txtPriority") as TextBox; if (txtPriority != null) { if (!string.IsNullOrEmpty(txtPriority.Text)) { profileScript.Priority = Convert.ToInt32(txtPriority.Text); } } EndUserMessage = Call.ImageProfileScriptApi.Post(profileScript).Success ? "Successfully Updated Image Profile" : "Could Not Update Image Profile"; } if (checkedCount == 0) { EndUserMessage = deleteResult ? "Successfully Updated Image Profile" : "Could Not Update Image Profile"; } }
public DtoActionResult Post(EntityImageProfileScript imageProfileScript) { return(_imageProfileScriptService.AddImageProfileScript(imageProfileScript)); }