Example #1
0
        public ActionResult Create(GigCreate gig)
        {
            if (!ModelState.IsValid)
            {
                return(View(gig));
            }

            IGigDAC dac = new GigDAC();

            dac.Add(gig.Description, gig.Venue, gig.Date);
            return(RedirectToAction("Index"));
        }
        public IHttpActionResult Post(GigCreate gig)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            GigService gigService = CreateGigService();

            if (!gigService.CreateGig(gig))
            {
                return(InternalServerError());
            }

            return(Ok());
        }
Example #3
0
        public bool CreateGig(GigCreate model)
        {
            var entity =
                new Gig()
            {
                UserId   = _userId,
                GigId    = model.GigId,
                TalentId = model.TalentRef,
                ArtistId = model.ArtistId,
                GigStart = model.GigStart,
                GigEnd   = model.GigEnd
                           //Author = model.Author
            };

            using (var ctx = new ApplicationDbContext())
            {
                //object p = ctx.Gig.Add(entity);
                ctx.Gigs.Add(entity);
                return(ctx.SaveChanges() == 1);
            }
        }