public JavaScriptResult Create(BranchViewModel branchvm) { try { _branchService.Add(Mapper.Map <Branch>(branchvm)); return(JavaScript($"ShowResult('{"Data saved successfully."}','{"success"}','{"redirect"}','{"/CPanel/Branch"}')")); } catch (Exception ex) { return(JavaScript($"ShowResult('{ex.Message}','failure')")); } }
public ActionResult Create(Branch model) { if (ModelState.IsValid) { branchService.Add(model); return(RedirectToAction("Index")); } else { return(View()); } }
public IActionResult Add(Branch branch) { var result = _branchService.Add(branch); if (result.Success) { return(Ok(result.Message)); } else { return(BadRequest(result.Message)); } }
private void bttn_brans_ekle_Click(object sender, EventArgs e) { if (tb_branch_name.Text == "" || tb_branch_name.Text.Length < 3) { _ = new uc_alertbox("Branşın ismi boş olamaz ve üç karakterden kısa olamaz.", uc_alertbox.AlertType.Error, this); return; } if (cb_branch_select.FindStringExact(tb_branch_name.Text) == 0) { _ = new uc_alertbox("Aynı ada sahip bir branş bulundu.", uc_alertbox.AlertType.Warning, this); return; } BranchService.Add(new Branch() { Name = tb_branch_name.Text }); _ = new uc_alertbox(string.Format("{0} adlı yeni branş başarıyla eklendi!", tb_branch_name.Text), uc_alertbox.AlertType.Success, this); LoadItems(); }
public HttpResponseMessage Post(HttpRequestMessage request, Branch b) { return(CreateHttpResponse(request, () => { HttpResponseMessage response = null; if (ModelState.IsValid) { request.CreateErrorResponse(HttpStatusCode.BadRequest, ModelState); } else { var branch = _branchService.Add(b); _branchService.SaveChanges(); response = request.CreateResponse(HttpStatusCode.Created, branch); } return response; })); }
public void Add(Branch obj) { _service.Add(obj); }
public IActionResult Create(CreateBranchDto createAddressDto) { var branch = _branchService.Add(createAddressDto); return(CreatedAtAction(nameof(Get), new { id = branch.Id }, branch)); }
public IActionResult Add(BranchDto branch) { _service.Add(branch); return(Ok()); }
public async Task <ActionResult <bool> > Add(InsertBranchModel request) { return(Ok(await _branchService.Add(await GetUserId(), request, GetPermissionId()))); }