Ejemplo n.º 1
0
        public ActionResult Add(Nt_FuncCrudViewModel model)
        {
            //LoggerFactory.CreateLog().Debug(string.Format(CultureInfo.InvariantCulture, "Presentation Layer - AddNt_Func Controller Begin"));

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

            ModelState.AddModelError("", PresentationResources.Error);
            return(View("Nt_FuncAddView", new Nt_FuncCrudViewModel(_serviceNt_Func, _serviceNutriente)));
        }
Ejemplo n.º 2
0
        // GET
        public ActionResult Add()
        {
            //LoggerFactory.CreateLog().Debug(string.Format(CultureInfo.InvariantCulture, "Presentation Layer - AddNt_Func Controller Begin"));

            try
            {
                // Add add logic here
                var model = new Nt_FuncCrudViewModel(_serviceNt_Func, _serviceNutriente);

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

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

            try
            {
                // Add remove logic here
                var model = new Nt_FuncCrudViewModel(_serviceNt_Func, _serviceNutriente)
                {
                    Nt_Func = _serviceNt_Func.Find(id)
                };

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

            return(RedirectToAction("Find"));
        }