Beispiel #1
0
        public ActionResult Dodaj(FormCollection collection)
        {
            var Model = new RokObrotowy();

            try
            {
                Model.IdFirmy = KancelariaSettings.IdFirmy(User.Identity.Name);

                UpdateModel(Model);

                if (Model.IsValid)
                {
                    LataObrotoweRepository.Dodaj(Model);
                    LataObrotoweRepository.Save();

                    TempData["Message"] = String.Format("Dodano rok oborotowy");

                    return(RedirectToAction("Kartoteka"));
                }
                else
                {
                    foreach (var rule in Model.GetRuleViolations())
                    {
                        ModelState.AddModelError(rule.PropertyName, rule.ErrorMessage);
                    }

                    return(View(Model));
                }
            }
            catch (Exception ex)
            {
                ViewBag.ErrorMessage = "Wystąpił błąd podczas dodawania roku obrotowego";
                Logger.ErrorFormat("Wystąpił błąd podczas dodawania roku obrotowego\n{0}", ex);

                return(View(Model));
            }
        }
Beispiel #2
0
 public void Usun(RokObrotowy rokObrotowy)
 {
     db.RokObrotowies.DeleteOnSubmit(rokObrotowy);
 }
Beispiel #3
0
        public ActionResult Dodaj()
        {
            var Model = new RokObrotowy();

            return(View(Model));
        }
Beispiel #4
0
 public void Dodaj(RokObrotowy rokObrotowy)
 {
     db.RokObrotowies.InsertOnSubmit(rokObrotowy);
 }