Ejemplo n.º 1
0
 public ActionResult EditMechanic(MechanicViewModel viewModel)
 {
     if (ModelState.IsValid)
     {
         var result = _MechanicManager.UpdateMechanic(viewModel);
         return(RedirectToAction("ListMechanic"));
     }
     return(View(viewModel));
 }
 public ActionResult Edit([Bind(Include = "Id,Name,Email,Phone,Make")] MechanicView mechanicview)
 {
     if (ModelState.IsValid)
     {
         _mechanicManager.UpdateMechanic(mechanicview);
         return(RedirectToAction("Index"));
     }
     return(View(mechanicview));
 }
 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));
 }
Ejemplo n.º 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));
 }
        // PUT: api/Mechanic/5
        public IHttpActionResult Put([FromBody] Mechanics mechanic)
        {
            var response = _IMechanicManager.UpdateMechanic(mechanic);

            return(Ok(response));
        }