Beispiel #1
0
        public async Task <IActionResult> Create(OfficeCreateInputModel input)
        {
            if (this.ModelState.IsValid == false)
            {
                return(this.View());
            }

            await this.officesService.CreateAsync(input.Country, input.City, input.Street, input.StreetNumber, input.IsHeadquarters, input.CompanyId);

            var companyCurrent = this.companiesService.GetById <CompanyViewModel>(input.CompanyId);

            this.TempData["InfoMessage"] = "Office successfully created!";
            return(this.RedirectToRoute("TaskDotNetCompany", new { name = companyCurrent.Name }));
        }
Beispiel #2
0
        public IActionResult Create(int companyId)
        {
            if (this.ModelState.IsValid == false)
            {
                return(this.View());
            }

            var viewModel = new OfficeCreateInputModel
            {
                CompanyId = companyId,
            };

            return(this.View(viewModel));
        }