Exemplo n.º 1
0
        public ActionResult Create(Create model)
        {
            if (string.IsNullOrWhiteSpace(model.NameOriginal) && string.IsNullOrWhiteSpace(model.NameRomaji) && string.IsNullOrWhiteSpace(model.NameEnglish))
                ModelState.AddModelError("Names", ViewRes.EntryCreateStrings.NeedName);

            if (model.Artists == null || !model.Artists.Any())
                ModelState.AddModelError("Artists", ViewRes.Song.CreateStrings.NeedArtist);

            if (!ModelState.IsValid)
                return View(model);

            var contract = model.ToContract();

            try {
                var song = Service.Create(contract);
                return RedirectToAction("Edit", new { id = song.Id });
            } catch (VideoParseException x) {
                ModelState.AddModelError("PVUrl", x.Message);
                return View(model);
            }
        }
Exemplo n.º 2
0
        public ActionResult Create(string pvUrl)
        {
            var model = new Create { PVUrl = pvUrl };

            return View(model);
        }