예제 #1
0
        public ActionResult Modify(Nt_GrpCrudViewModel model)
        {
            //LoggerFactory.CreateLog().Debug(string.Format(CultureInfo.InvariantCulture, "Presentation Layer - ModifyNt_Grp Controller Begin"));

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

            ModelState.AddModelError("", PresentationResources.Error);
            return(View("Nt_GrpModifyView", new Nt_GrpCrudViewModel(_serviceNt_Grp, _serviceNt_Grp_Cant, _serviceNutriente)));
        }
예제 #2
0
        // GET
        public ActionResult Add()
        {
            //LoggerFactory.CreateLog().Debug(string.Format(CultureInfo.InvariantCulture, "Presentation Layer - AddNt_Grp Controller Begin"));

            try
            {
                // Add add logic here
                var model = new Nt_GrpCrudViewModel(_serviceNt_Grp, _serviceNt_Grp_Cant, _serviceNutriente);

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

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

            try
            {
                // Add remove logic here
                var model = new Nt_GrpCrudViewModel(_serviceNt_Grp, _serviceNt_Grp_Cant, _serviceNutriente)
                {
                    Nt_Grp = _serviceNt_Grp.Find(id)
                };

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

            return(RedirectToAction("Find"));
        }