Example #1
0
        public async Task <IActionResult> PutPresence(int id, Model.InsertRequests.PresenceInsertRequest request)
        {
            var presence = _mapper.Map <AuthoAPI.Models.Presence>(request);

            presence.Id = id;

            _context.Entry(presence).State = EntityState.Modified;
            try
            {
                await _context.SaveChangesAsync();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!PresenceExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(NoContent());
        }
Example #2
0
        public async Task <ActionResult <Presence> > PostPresence(Model.InsertRequests.PresenceInsertRequest request)
        {
            var presence = _mapper.Map <Models.Presence>(request);

            _context.Presence.Add(presence);
            await _context.SaveChangesAsync();

            return(CreatedAtAction("GetPresence", new { id = presence.Id }, presence));
        }