Example #1
0
        public async Task <IActionResult> Update([FromForm] PositionsUpdateRequest request)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }
            var affectedResult = await _positionsService.Update(request);

            if (affectedResult == 0)
            {
                return(BadRequest());
            }
            return(Ok());
        }
Example #2
0
        public async Task <HttpResponseMessage> Put(int id, [FromBody] PositionDto value)
        {
            PositionDto posdto = await positionService.GetAsync(id);

            if (posdto != null)
            {
                posdto = await positionService.Update(value);

                if (posdto != null)
                {
                    return(new HttpResponseMessage(HttpStatusCode.OK));
                }
                return(new HttpResponseMessage(HttpStatusCode.NotModified));
            }
            else
            {
                return(new HttpResponseMessage(HttpStatusCode.NotFound));
            }
        }