示例#1
0
        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"));
        }