public HttpResponseMessage EditBranches(BranchModel aBranchModel) { try { if (this.ModelState.IsValid) { var user = service.EditBranch(aBranchModel); if (user != null) { return(Request.CreateResponse(HttpStatusCode.OK, user)); } else { string message = "Not updated successfully"; return(Request.CreateErrorResponse(HttpStatusCode.Forbidden, message)); } } else { return(Request.CreateErrorResponse(HttpStatusCode.BadRequest, ModelState)); } } catch (Exception ex) { return(Request.CreateErrorResponse(HttpStatusCode.InternalServerError, ex)); } }
public ActionResult Edit([Bind(Include = "BranchId,BranchName,BranchLocation,BranchDescription")] Branch branch) { if (ModelState.IsValid) { if (_branchService.EditBranch(branch)) { return(RedirectToAction("Index")); } } return(View(branch)); }
public IActionResult EditBranch([FromBody] MvBranch branch) { try { branchService.EditBranch(branch); return Ok(); } catch (Exception ex) { return BadRequest(ex.Message); } }
public IActionResult Update([FromBody] Branch branch) { try { _branchService.EditBranch(branch); return(Ok()); } catch (Exception) { return(BadRequest("Branch not found")); } }
public async Task <IActionResult> EditBranch(EditBranchParameters enterpriseBranch) { if (ModelState.IsValid) { var temp = await branchService.EditBranch(enterpriseBranch); if (temp != null) { return(Ok(temp)); } else { return(BadRequest(new { Message = "Something went wrong. Please, try again later." })); } } else { return(BadRequest(new { Message = "Invalid parameters supplied." })); } }