コード例 #1
0
 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));
     }
 }
コード例 #2
0
 public ActionResult Edit([Bind(Include = "BranchId,BranchName,BranchLocation,BranchDescription")] Branch branch)
 {
     if (ModelState.IsValid)
     {
         if (_branchService.EditBranch(branch))
         {
             return(RedirectToAction("Index"));
         }
     }
     return(View(branch));
 }
コード例 #3
0
 public IActionResult EditBranch([FromBody] MvBranch branch)
 {
     try
     {
         branchService.EditBranch(branch);
         return Ok();
     }
     catch (Exception ex)
     {
         return BadRequest(ex.Message);
     }
 }
コード例 #4
0
 public IActionResult Update([FromBody] Branch branch)
 {
     try
     {
         _branchService.EditBranch(branch);
         return(Ok());
     }
     catch (Exception)
     {
         return(BadRequest("Branch not found"));
     }
 }
コード例 #5
0
        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." }));
            }
        }