Ejemplo n.º 1
0
        public IActionResult Create(String returnUrl)
        {
            if (String.IsNullOrEmpty(returnUrl))
            {
                returnUrl = Request.Headers["Referer"].ToString();
            }

            return(View("Edit", VisitTypeViewModelFactory.Create(new VisitTypeDto(), returnUrl)));
        }
Ejemplo n.º 2
0
        public async Task <IActionResult> Details(int id)
        {
            var returnUrl = Request.Headers["Referer"].ToString();

            var visitType = await _visitTypeRepo.GetVisitType(id);

            VisitTypeViewModel companyVM = VisitTypeViewModelFactory.Details(visitType, returnUrl);

            return(View("Edit", companyVM));
        }
Ejemplo n.º 3
0
        public async Task <IActionResult> Edit(int id, string returnUrl = null)
        {
            if (String.IsNullOrEmpty(returnUrl))
            {
                returnUrl = Request.Headers["Referer"].ToString();
            }

            var visitType = await _visitTypeRepo.GetVisitType(id);

            VisitTypeViewModel visitTypeVM = VisitTypeViewModelFactory.Edit(visitType, returnUrl);

            return(View("Edit", visitTypeVM));
        }
Ejemplo n.º 4
0
        public async Task <IActionResult> Edit([FromForm] VisitTypeViewModel visitTypeVM)
        {
            if (ModelState.IsValid)
            {
                await _visitTypeRepo.UpdateVisitType(visitTypeVM.VisitType);

                TempData["message"]     = "Your data has been updated successfully.";
                TempData["toasterType"] = ToasterType.success;

                return(RedirectToAction(nameof(Edit), new { id = visitTypeVM.VisitType.Id, returnUrl = visitTypeVM.ReturnUrl }));
            }
            else
            {
                TempData["message"]     = "A problem has been ocurred while updating your data.";
                TempData["toasterType"] = ToasterType.info;
            }

            return(View("Edit", VisitTypeViewModelFactory.Edit(visitTypeVM.VisitType, visitTypeVM.ReturnUrl)));
        }
Ejemplo n.º 5
0
        public async Task <IActionResult> Create([FromForm] VisitTypeViewModel visitTypeVM)
        {
            if (ModelState.IsValid)
            {
                var newVisitType = await _visitTypeRepo.AddVisitType(visitTypeVM.VisitType);

                TempData["message"]     = "Your data has been submitted successfully.";
                TempData["toasterType"] = ToasterType.success;

                //return RedirectToAction(nameof(Index));

                return(RedirectToAction(nameof(Edit), new { id = newVisitType.Id, returnUrl = visitTypeVM.ReturnUrl }));
            }

            TempData["message"]     = "A problem has been ocurred while submitting your data.";
            TempData["toasterType"] = ToasterType.info;

            return(View("Edit", VisitTypeViewModelFactory.Create(visitTypeVM.VisitType, visitTypeVM.ReturnUrl)));
        }