Exemple #1
0
        public ActionResult Create([Bind(Include = "AbsencePolicyId,Name")] AbsencePolicy absencePolicy)
        {
            if (ModelState.IsValid)
            {
                absencePolicy.OrganisationId = UserOrganisationId;
                var result = HRBusinessService.CreateAbsencePolicy(UserOrganisationId, absencePolicy);
                if (result.Succeeded)
                {
                    return(RedirectToAction("Edit", new { id = result.Entity.AbsencePolicyId }));
                }
                foreach (var error in result.Errors)
                {
                    ModelState.AddModelError("", error);
                }
            }
            var viewModel = new AbsencePolicyViewModel
            {
                AbsencePolicy = new AbsencePolicy()
            };

            return(View(viewModel));
        }