示例#1
0
        public JsonResult JsUpdate(Cargo cargo)
        {
            var cargoDAO = new CargoDAO();

            cargoDAO.UpdateCargo(cargo);

            var result = new
            {
                type    = "success",
                field   = "",
                message = "Registro alterado com sucesso!",
                model   = cargo
            };

            return(Json(result, JsonRequestBehavior.AllowGet));
        }
示例#2
0
        public ActionResult Edit(int id, Cargo cargo)
        {
            if (string.IsNullOrWhiteSpace(cargo.dsCargo))
            {
                ModelState.AddModelError("dsCargo", "Informe um nome de cargo válido");
            }
            try
            {
                if (ModelState.IsValid)
                {
                    var cargoDAO = new CargoDAO();

                    cargoDAO.UpdateCargo(cargo);

                    return(RedirectToAction("Index"));
                }
                return(View());
            }
            catch
            {
                return(View());
            }
        }