Пример #1
0
        public ActionResult Settings()
        {
            CompanySettingsVM model = new CompanySettingsVM();
            var mgr     = new CompanyManager();
            var company = mgr.GetAll().FirstOrDefault();

            model = TinyMapper.Map <CompanySettingsVM>(company);
            return(View(model));
        }
Пример #2
0
        public ActionResult Settings(CompanySettingsVM model)
        {
            //var newCompany = TinyMapper.Map<WFP.ICT.Data.Entities.Company>(model);
            try
            {
                var mgr     = new CompanyManager();
                var company = mgr.GetAll().FirstOrDefault(x => x.Id == model.Id);
                company.Name    = model.Name;
                company.Details = model.Details;
                company.WebSite = model.WebSite;
                company.Logo    = model.Logo;
                mgr.Update(company);
                MvcApplication.LoadCompany();

                TempData["Success"] = $"Settings has been saved sucessfully.";
            }
            catch (Exception ex)
            {
                TempData["Error"] = "This is error while saving settings." + ex.Message;
            }
            return(RedirectToAction("Settings"));
        }
Пример #3
0
        public ActionResult CheckMailSettings(CompanySettingsVM model)
        {
            try
            {
                bool IsAuthenticated = true;

                if (!IsAuthenticated)
                {
                    throw new Exception("Email credentials are not valid.");
                }

                return(Json(new JsonResponse()
                {
                    IsSucess = IsAuthenticated
                }, JsonRequestBehavior.AllowGet));
            }
            catch (Exception ex)
            {
                return(Json(new JsonResponse()
                {
                    IsSucess = false, ErrorMessage = ex.Message
                }, JsonRequestBehavior.AllowGet));
            }
        }