コード例 #1
0
 public ActionResult EditMechanic(MechanicViewModel viewModel)
 {
     if (ModelState.IsValid)
     {
         var result = _MechanicManager.UpdateMechanic(viewModel);
         return(RedirectToAction("ListMechanic"));
     }
     return(View(viewModel));
 }
コード例 #2
0
 public ActionResult Edit([Bind(Include = "Id,Name,Email,Phone,Make")] MechanicView mechanicview)
 {
     if (ModelState.IsValid)
     {
         _mechanicManager.UpdateMechanic(mechanicview);
         return(RedirectToAction("Index"));
     }
     return(View(mechanicview));
 }
コード例 #3
0
 public ActionResult Edit(MechanicViewModel mechanic)
 {
     if (ModelState.IsValid)
     {
         string update = _mechanicManager.UpdateMechanic(mechanic);
         return(RedirectToAction("Index"));
     }
     ViewBag.DeptId = new SelectList(_departmentManager.GetAllDepartment(), "DeptId", "Department1");
     return(View(mechanic));
 }
コード例 #4
0
 public ActionResult Edit(MechanicViewModel mechanic)
 {
     // Exception handling
     try
     {
         if (ModelState.IsValid)
         {
             string update = _mechanicManager.UpdateMechanic(mechanic);
             Log.Info("Mechanic update Successffuly");
             return(RedirectToAction("Index"));
         }
     }
     // Catch the exception
     catch (Exception ex)
     {
         Log.Error(ex.ToString());
         ModelState.AddModelError("", "Error in mechanic updating");
     }
     return(View(mechanic));
 }
コード例 #5
0
        // PUT: api/Mechanic/5
        public IHttpActionResult Put([FromBody] Mechanics mechanic)
        {
            var response = _IMechanicManager.UpdateMechanic(mechanic);

            return(Ok(response));
        }