Beispiel #1
0
        public ActionResult ReleaseOfPrisoner(ReleaseOfPrisonerViewModel model)
        {
            if (ModelState.IsValid)
            {
                var detention = prisonerProvider.GetDetentionById(model.DetentionID);
                if (detention != null && detention.DateOfRelease == null)
                {
                    var releaseOfPriosner = Mapper.Map <ReleaseOfPrisonerViewModel, ReleaseOfPrisoner>(model);

                    prisonManager.ReleaseOfPrisoner(releaseOfPriosner);
                    return(RedirectToAction("DetailsOfPrisoner", "Prisoner", new { id = detention.PrisonerID }));
                }
            }
            return(View(model));
        }
Beispiel #2
0
        public ActionResult ReleaseOfPrisoner(int?detentionID)
        {
            if (!detentionID.HasValue)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }

            var detention = prisonerProvider.GetDetentionById(detentionID.Value);

            if (detention == null)
            {
                return(HttpNotFound());
            }
            var model = new ReleaseOfPrisonerViewModel()
            {
                DetentionID = detentionID.Value
            };

            return(View(model));
        }