Esempio n. 1
0
        public async Task <IHttpActionResult> Post(Chore chore)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            chore.Id          = Guid.NewGuid();
            chore.Active      = true;
            chore.CreatedDate = _time.UtcNow;
            chore.ObjectState = ObjectState.Added;
            _choreService.Insert(chore);

            await _unitOfWorkAsync.SaveChangesAsync();

            return(new CreatedContentActionResult(Request, Url.Link("GetChore", new { id = chore.Id })));
        }