public void Patch(string id, [FromBody] MergePatchFacilityDto value) { try { FacilitiesControllerUtils.SetNullIdOrThrowOnInconsistentIds(id, value); _facilityApplicationService.When(value as IMergePatchFacility); } catch (Exception ex) { var response = FacilitiesControllerUtils.GetErrorHttpResponseMessage(ex); throw new HttpResponseException(response); } }
public void Delete(string id, string commandId, string version, string requesterId = default(string)) { try { var value = new DeleteFacilityDto(); value.CommandId = commandId; value.RequesterId = requesterId; value.Version = (long)Convert.ChangeType(version, typeof(long)); FacilitiesControllerUtils.SetNullIdOrThrowOnInconsistentIds(id, value); _facilityApplicationService.When(value as IDeleteFacility); } catch (Exception ex) { var response = FacilitiesControllerUtils.GetErrorHttpResponseMessage(ex); throw new HttpResponseException(response); } }
public void Put(string id, [FromBody] CreateOrMergePatchOrDeleteFacilityDto value) { try { // /////////////////////////////// if (value.Version != default(long)) { value.CommandType = CommandType.MergePatch; FacilitiesControllerUtils.SetNullIdOrThrowOnInconsistentIds(id, value); _facilityApplicationService.When(value as IMergePatchFacility); return; } // /////////////////////////////// FacilitiesControllerUtils.SetNullIdOrThrowOnInconsistentIds(id, value); _facilityApplicationService.When(value as ICreateFacility); } catch (Exception ex) { var response = FacilitiesControllerUtils.GetErrorHttpResponseMessage(ex); throw new HttpResponseException(response); } }