Esempio 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");
            }
        }
Esempio 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 });
            }
        }
Esempio 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);
            }
        }
Esempio n. 4
0
 private void FillSelf(Budget model)
 {
     Id = model.Id;
     Name = model.Name;
     Descr = model.Descr;
     IdParent = model.IdParent;
 }