Example #1
0
        public ActionResult Modify(FactConvCrudViewModel model)
        {
            //LoggerFactory.CreateLog().Debug(string.Format(CultureInfo.InvariantCulture, "Presentation Layer - ModifyFactConv Controller Begin"));

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

            ModelState.AddModelError("", PresentationResources.Error);
            return(View("FactConvModifyView", new FactConvCrudViewModel(_serviceFactConv, _serviceAlim, _serviceMedida)));
        }
Example #2
0
        // GET
        public ActionResult Add()
        {
            //LoggerFactory.CreateLog().Debug(string.Format(CultureInfo.InvariantCulture, "Presentation Layer - AddFactConv Controller Begin"));

            try
            {
                // Add add logic here
                var model = new FactConvCrudViewModel(_serviceFactConv, _serviceAlim, _serviceMedida);

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

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

            try
            {
                // Add remove logic here
                var model = new FactConvCrudViewModel(_serviceFactConv, _serviceAlim, _serviceMedida)
                {
                    FactConv = _serviceFactConv.Find(id)
                };

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

            return(RedirectToAction("Find"));
        }