public async Task <IActionResult> CreateExcursionType(ExcursionTypeCreateInputModel model)
        {
            if (!ModelState.IsValid)
            {
                //we`ll return the input values i think
                this.RedirectToAction("CreateExcursionType", "ExcursionOperator", model);
            }
            bool isSuccessful = await this.excursionServices.ExcursionTypeCreate(model);

            return(Redirect("/Home/Index"));
        }
Пример #2
0
        public async Task <bool> ExcursionTypeCreate(ExcursionTypeCreateInputModel model)
        {
            var excursionTypeToAdd = new ExcursionType()
            {
                Name = model.Name
            };
            await context.ExcursionTypes.AddAsync(excursionTypeToAdd);

            await context.SaveChangesAsync();

            return(true);
        }