Ejemplo n.º 1
0
        public IHttpActionResult Put(RepDetail rep)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }


            if (!repService.UpdateRep(rep))
            {
                return(InternalServerError());
            }

            return(Ok());
        }
Ejemplo n.º 2
0
        public ActionResult Edit(int id, RepDetail model)
        {
            if (!ModelState.IsValid)
            {
                return(View(model));
            }

            if (model.ID != id)
            {
                ModelState.AddModelError("", "Id Mismatch");
                return(View(model));
            }

            var service = new RepService();

            if (service.UpdateRep(model))
            {
                TempData["SaveResult"] = "Rep Details Successfully Updated";
                return(RedirectToAction("Index"));
            }

            ModelState.AddModelError("", "Failed to Update Rep");
            return(View(model));
        }