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

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

            ModelState.AddModelError("", PresentationResources.Error);
            return(View("ImagenesAddView", new ImagenesCrudViewModel(_serviceImagenes, _serviceUserPhotos)));
        }
Exemplo n.º 2
0
        // GET
        public ActionResult Add()
        {
            //LoggerFactory.CreateLog().Debug(string.Format(CultureInfo.InvariantCulture, "Presentation Layer - AddImagenes Controller Begin"));

            try
            {
                // Add add logic here
                var model = new ImagenesCrudViewModel(_serviceImagenes, _serviceUserPhotos);

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

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

            try
            {
                // Add remove logic here
                var model = new ImagenesCrudViewModel(_serviceImagenes, _serviceUserPhotos)
                {
                    Imagenes = _serviceImagenes.Find(id)
                };

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

            return(RedirectToAction("Find"));
        }