public IHttpActionResult Post(TalentCreate talent)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            var service = CreateTalentService();

            if (!service.CreateTalent(talent))
            {
                return(InternalServerError());
            }

            return(Ok());
        }
Exemplo n.º 2
0
        public bool CreateTalent(TalentCreate model)
        {
            var entity =
                new Talent()
            {
                UserId            = _userId,
                TalentTitle       = model.TalentTitle,
                TalentDescription = model.TalentDescription
            };

            using (var ctx = new ApplicationDbContext())
            {
                ctx.Talents.Add(entity);
                return(ctx.SaveChanges() == 1);
            }
        }