public async Task <IHttpActionResult> UpdateGarage() { ResponseDataDTO <int> response = new ResponseDataDTO <int>(); try { var path = Path.GetTempPath(); MultipartFormDataStreamProvider streamProvider = new MultipartFormDataStreamProvider(path); GarageViewModel GarageViewModel = new GarageViewModel { GarageID = Guid.Parse(streamProvider.FormData["GarageID"]), GarageName = Convert.ToString(streamProvider.FormData["GarageName"]), Address = Convert.ToString(streamProvider.FormData["Address"]), DateStart = Convert.ToDateTime(streamProvider.FormData["DateStart"]), DateEnd = Convert.ToDateTime(streamProvider.FormData["DateEnd"]) }; var existGarage = _Garageservice.Find(GarageViewModel.GarageID); // mapping view model to entity var updatedGarage = _mapper.Map <Garage>(GarageViewModel); // update quantity updatedGarage.GarageName = existGarage.GarageName; updatedGarage.Address = existGarage.Address; updatedGarage.DateStart = existGarage.DateStart; updatedGarage.DateEnd = existGarage.DateEnd; // update Garage _Garageservice.Update(updatedGarage, updatedGarage.GarageID); // return response response.Code = HttpCode.OK; response.Message = MessageResponse.SUCCESS; response.Data = 1; return(Ok(response)); } catch (Exception ex) { response.Code = HttpCode.INTERNAL_SERVER_ERROR; response.Message = MessageResponse.FAIL; response.Data = 0; Console.WriteLine(ex.ToString()); return(Ok(response)); } }