Exemple #1
0
        public ActionResult Add(UniMedCrudViewModel model)
        {
            //LoggerFactory.CreateLog().Debug(string.Format(CultureInfo.InvariantCulture, "Presentation Layer - AddUniMed Controller Begin"));

            try
            {
                // Add add logic here
                if (ModelState.IsValid)
                {
                    var committed = _serviceUniMed.Insert(model.UniMed, null);
                    _unitOfWork.SaveChanges();
                    if (committed)
                    {
                        //LoggerFactory.CreateLog().Debug(string.Format(CultureInfo.InvariantCulture, "Presentation Layer - AddUniMed Controller End"));
                        return(RedirectToAction("Add"));
                    }
                }
            }
            catch (Exception ex)
            {
                //LoggerFactory.CreateLog().Error(string.Format(CultureInfo.InvariantCulture, "Presentation Layer - AddUniMed Controller ERROR"), ex);
            }

            ModelState.AddModelError("", PresentationResources.Error);
            return(View("UniMedAddView", new UniMedCrudViewModel(_serviceUniMed, _serviceAlim)));
        }
Exemple #2
0
        // GET
        public ActionResult Add()
        {
            //LoggerFactory.CreateLog().Debug(string.Format(CultureInfo.InvariantCulture, "Presentation Layer - AddUniMed Controller Begin"));

            try
            {
                // Add add logic here
                var model = new UniMedCrudViewModel(_serviceUniMed, _serviceAlim);

                //LoggerFactory.CreateLog().Debug(string.Format(CultureInfo.InvariantCulture, "Presentation Layer - AddUniMed Controller End"));
                return(View("UniMedAddView", model));
            }
            catch (Exception ex)
            {
                //LoggerFactory.CreateLog().Error(string.Format(CultureInfo.InvariantCulture, "Presentation Layer - AddUniMed Controller ERROR"), ex);
            }

            return(RedirectToAction("Index", "Home"));
        }
Exemple #3
0
        // GET
        public ActionResult Remove(int id)
        {
            //LoggerFactory.CreateLog().Debug(string.Format(CultureInfo.InvariantCulture, "Presentation Layer - RemoveUniMed Controller Begin"));

            try
            {
                // Add remove logic here
                var model = new UniMedCrudViewModel(_serviceUniMed, _serviceAlim)
                {
                    UniMed = _serviceUniMed.Find(id)
                };

                //LoggerFactory.CreateLog().Debug(string.Format(CultureInfo.InvariantCulture, "Presentation Layer - RemoveUniMed Controller End"));
                return(View("UniMedRemoveView", model));
            }
            catch (Exception ex)
            {
                //LoggerFactory.CreateLog().Error(string.Format(CultureInfo.InvariantCulture, "Presentation Layer - RemoveUniMed Controller ERROR"), ex);
            }

            return(RedirectToAction("Find"));
        }