예제 #1
0
        public async Task <IHttpActionResult> UpdateMode([FromUri] int id, [FromBody] UpdateModeRequest updateRequest)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            await _modeRepositoryService.UpdateEntityAsync(updateRequest, id);

            return(Ok(ResponseMessage(Request.CreateResponse(HttpStatusCode.NoContent)).ToString()));
        }
예제 #2
0
        public async Task <IHttpActionResult> AddMode([FromBody] UpdateModeRequest createRequest)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            var mode = await _modeRepositoryService.AddEntityAsync(createRequest);

            var location = string.Format("/api/modes/single/{0}", mode.Id);

            return(Ok());
        }