Esempio n. 1
0
        public HttpResponse Create(CreateInputViewModel cim)
        {
            if (!IsUserLoggedIn())
            {
                this.Redirect("/Users/Login");
            }

            if (string.IsNullOrWhiteSpace(cim.Name) || string.IsNullOrWhiteSpace(cim.Cover))
            {
                this.Redirect("/Albums/Create");
            }

            this.albumsService.Create(cim.Name, cim.Cover);
            return(this.Redirect("/Albums/All"));
        }
        public ActionResult Create(CreateInputViewModel input)
        {
            if (ModelState.IsValid)
            {
                var userId = this.User.Identity.GetUserId();

                var feedback = new Feedback
                {
                    Title    = input.Title,
                    Content  = this.sanitizer.Sanitize(input.Content),
                    AuthorId = userId
                };

                this.feedbacks.Add(feedback);
                this.feedbacks.SaveChanges();
                return(this.RedirectToAction("Index", "Home"));
            }

            return(this.View(input));
        }
        public ActionResult Create()
        {
            var model = new CreateInputViewModel();

            return(this.View(model));
        }