Beispiel #1
0
        public ActionResult Add(Log4netCrudViewModel model)
        {
            //LoggerFactory.CreateLog().Debug(string.Format(CultureInfo.InvariantCulture, "Presentation Layer - AddLog4net Controller Begin"));

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

            ModelState.AddModelError("", PresentationResources.Error);
            return(View("Log4netAddView", new Log4netCrudViewModel(_serviceLog4net)));
        }
Beispiel #2
0
        // GET
        public ActionResult Add()
        {
            //LoggerFactory.CreateLog().Debug(string.Format(CultureInfo.InvariantCulture, "Presentation Layer - AddLog4net Controller Begin"));

            try
            {
                // Add add logic here
                var model = new Log4netCrudViewModel(_serviceLog4net);

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

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

            try
            {
                // Add remove logic here
                var model = new Log4netCrudViewModel(_serviceLog4net)
                {
                    Log4net = _serviceLog4net.Find(id)
                };

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

            return(RedirectToAction("Find"));
        }