コード例 #1
0
ファイル: PostHandler.cs プロジェクト: squidge/fubu101
        public FubuContinuation Execute(AddInputModel inputModel)
        {
            var db = Database.OpenFile(HttpContext.Current.Server.MapPath("~/App_Data/fubu101.db"));
            db.movies.Insert(title: inputModel.Title, year: inputModel.Year);

            return FubuContinuation.RedirectTo(new MovieRequestModel());
        }
コード例 #2
0
        public async Task <IActionResult> Add(AddInputModel inputModel)
        {
            var userId = this.userManager.GetUserId(this.User);
            var date   = DateTime.Parse(inputModel.Date);

            await this.expenseService.AddAsync(userId, inputModel.Amount, date, inputModel.IsRepeating);

            return(this.Redirect("/Home/Index"));
        }
コード例 #3
0
        public HttpResponse Add(AddInputModel inputModel)
        {
            if (!this.IsUserLoggedIn())
            {
                return(this.Redirect("/Users/Login"));
            }

            if (inputModel.Name.Length < 4 || inputModel.Name.Length > 20)
            {
                return(this.Redirect("/Products/Add"));
            }

            if (string.IsNullOrWhiteSpace(inputModel.Description) || inputModel.Description.Length > 10)
            {
                return(this.Redirect("/Products/Add"));
            }

            this.productsService.Add(inputModel.Name, inputModel.Description,
                                     inputModel.ImageURL, inputModel.Category, inputModel.Gender, inputModel.Price);

            return(this.Redirect("/Home"));
        }