Пример #1
0
        public ActionResult Create(CompanyModel model)
        {
            if (ModelState.IsValid)
            {
                var company = new Company
                {
                    CompanyName = model.CompanyName,
                    Abbreviation = model.Abbreviation,
                    CreatedOn = DateTime.UtcNow,
                    LogoId = new Guid(model.LogoId),
                    UpdatedOn = DateTime.UtcNow,
                    CurrentPublishingStatus = PublishingStatus.Active // by default the client status is active
                };

                // we need to add this company
                companyService.Insert(company);

                // return notification message
                SuccessNotification(localizationService.GetResource("Company.Added"));
                return RedirectToAction(SystemRouteNames.Index);
            }

            return View(model);
        }
Пример #2
0
        public ActionResult Create()
        {
            var model = new CompanyModel();

            return View(model);
        }
Пример #3
0
        private CompanyModel PrepareCompanyMode( Company company )
        {
            Guard.IsNotNull(company, "company");

            var model = new CompanyModel()
                {
                    RowId = company.RowId,
                    CompanyName = company.CompanyName,
                    Abbreviation = company.Abbreviation,
                    LogoId = fileDataService.GetFileUrl(company.LogoId.Value),
                };

            PrepareAuditHistoryModel(model, company);

            return model;
        }