Esempio n. 1
0
        public ActionResult Modify(Nt_CantCrudViewModel model)
        {
            //LoggerFactory.CreateLog().Debug(string.Format(CultureInfo.InvariantCulture, "Presentation Layer - ModifyNt_Cant Controller Begin"));

            try
            {
                // Add modify logic here
                if (ModelState.IsValid)
                {
                    var committed = _serviceNt_Cant.Update(model.Nt_Cant, null);
                    _unitOfWork.SaveChanges();
                    if (committed)
                    {
                        //LoggerFactory.CreateLog().Debug(string.Format(CultureInfo.InvariantCulture, "Presentation Layer - ModifyNt_Cant Controller End"));
                        return(RedirectToAction("Find"));
                    }
                }
            }
            catch (Exception ex)
            {
                //LoggerFactory.CreateLog().Error(string.Format(CultureInfo.InvariantCulture, "Presentation Layer - ModifyNt_Cant Controller ERROR"), ex);
            }

            ModelState.AddModelError("", PresentationResources.Error);
            return(View("Nt_CantModifyView", new Nt_CantCrudViewModel(_serviceNt_Cant, _serviceAlim, _serviceNutriente, _serviceNt_Fuente)));
        }
Esempio n. 2
0
        // GET
        public ActionResult Add()
        {
            //LoggerFactory.CreateLog().Debug(string.Format(CultureInfo.InvariantCulture, "Presentation Layer - AddNt_Cant Controller Begin"));

            try
            {
                // Add add logic here
                var model = new Nt_CantCrudViewModel(_serviceNt_Cant, _serviceAlim, _serviceNutriente, _serviceNt_Fuente);

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

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

            try
            {
                // Add remove logic here
                var model = new Nt_CantCrudViewModel(_serviceNt_Cant, _serviceAlim, _serviceNutriente, _serviceNt_Fuente)
                {
                    Nt_Cant = _serviceNt_Cant.Find(id)
                };

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

            return(RedirectToAction("Find"));
        }