public ActionResult <bool> DeletePhoto(DeletePhotoModel photoModel) { try { _repository.DeletePhoto(new Photo { PhotoNum = photoModel.PhotoNum, User = LoggedUser }); return(true); } catch (Exception ex) { return(false); } }
public async Task <IActionResult> Delete([FromBody] DeletePhotoModel model) { if (!model.Id.HasValue) { return(BadRequestJsonResult(JsonResponse.ErrorResponse("Photo id not specified!"))); } try { await _photoService.DeleteAsync(model.Id.Value); return(OkJsonResult(JsonResponse.SuccessResponse("Photo was delete with success!"))); } catch (Exception exception) { _appLogger.LogError(exception); return(BadRequest(JsonResponse.ErrorResponse(exception))); } }