예제 #1
0
        public async Task <ActionResult> UpdateAsync(int id, [FromBody] NodeTypeViewModel model)
        {
            NodeTypeEntity Request = mapper.Map <NodeTypeViewModel, NodeTypeEntity>(model);

            if (id != model.Id)
            {
                return(BadRequest());
            }

            try
            {
                await service.UpdateAsync(Request);
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!service.NodeTypeExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(NoContent());
        }
예제 #2
0
        public async Task <ActionResult> UpdateAsync(int id, [FromBody] NodeTypeViewModel model)
        {
            NodeType Entry = await service.GetByIdAsync(id);

            if (Entry == null)
            {
                return(NotFound());
            }

            NodeType Request = mapper.Map <NodeTypeViewModel, NodeType>(model);

            await service.UpdateAsync(id, Request);

            return(NoContent());
        }