Ejemplo n.º 1
0
        public ActionResult Edit(int? id)
        {
            var user = DisplayCurUser();
            if (!user.HasAccess(AdGroup.PersonalManager)) return RedirectToAction("AccessDenied", "Error");

            if (id.HasValue)
            {
                var dep = new Budget(id.Value);
                return View(dep);
            }
            else
            {
                return View("New");
            }
        }
Ejemplo n.º 2
0
        public ActionResult Edit(Budget model)
        {
            if (!CurUser.HasAccess(AdGroup.PersonalManager)) return RedirectToAction("AccessDenied", "Error");

            try
            {
                ResponseMessage responseMessage;
                bool complete = model.Save(out responseMessage);
                if (!complete) throw new Exception(responseMessage.ErrorMessage);

                return RedirectToAction("Index", new { id = responseMessage.Id });
            }
            catch (Exception ex)
            {
                ViewData["ServerError"] = ex.Message;
                return RedirectToAction("Edit", new { id = model.Id });
            }
        }
Ejemplo n.º 3
0
        public ActionResult Index(Budget model)
        {
            if (!CurUser.HasAccess(AdGroup.PersonalManager)) return RedirectToAction("AccessDenied", "Error");

            try
            {
                ResponseMessage responseMessage;
                bool complete = model.Save(out responseMessage);
                if (!complete) throw new Exception(responseMessage.ErrorMessage);
                TempData["ServerSuccess"] = "Бюджет успешно добавлен";
                return RedirectToAction("Index");
            }
            catch (Exception ex)
            {
                TempData["ServerError"] = ex.Message;
                return View("Index", model);
            }
        }
Ejemplo n.º 4
0
 private void FillSelf(Budget model)
 {
     Id = model.Id;
     Name = model.Name;
     Descr = model.Descr;
     IdParent = model.IdParent;
 }