Exemple #1
0
        public ActionResult Edit(Guid id)
        {
            try
            {
                var dbModel = _licenseService.Get(id.ToString());
                if (dbModel != null)
                {
                    var result = new CreateLicenseModel(dbModel);
                    if (result != null)
                    {
                        return(View(result));
                    }
                }
            }
            catch (Exception ex)
            {
                _logger.Log(LogLevel.Error, ex);
            }

            return(Content("License not found"));
        }
Exemple #2
0
        public ActionResult Edit(CreateLicenseModel model)
        {
            try
            {
                if (!ModelState.IsValid)
                {
                    return(View(model));
                }

                if (_licenseService.Update(model.Id.ToString(), model.ToUpdateDbModel(_userService), UserId))
                {
                    return(Success());
                }
            }
            catch (Exception ex)
            {
                _logger.Log(LogLevel.Error, ex);
            }

            ViewBag.ErrorMessage = "Възникна грешка!";
            return(View(new CreateLicenseModel(model)));
        }
Exemple #3
0
        public ActionResult Create(CreateLicenseModel model)
        {
            try
            {
                if (!ModelState.IsValid)
                {
                    return(View(model));
                }

                var id = _licenseService.Create(model.ToDbModel(_userService), UserId);
                if (!string.IsNullOrEmpty(id))
                {
                    return(Success());
                }
            }
            catch (Exception ex)
            {
                _logger.Log(LogLevel.Error, ex);
            }

            ViewBag.ErrorMessage = "Възникна грешка!";
            return(View(new CreateLicenseModel(model)));
        }