/// <summary> /// Удаляет данные персоны асинхронно /// </summary> /// <param name="request"></param> /// <returns></returns> public async Task <DeletePersonResponse> DeleteAsync(DeletePersonRequest request) { if (request == null) { throw new ArgumentNullException("Person model DeletePersonRequest is invalid"); } var resp = new DeletePersonResponse(); try { var unit = factory.CreateUnitOfWork(); unit.Persons.Delete(request.Id); await unit.SaveAsync(); } catch (Exception e) { resp.AddMessage(new Contracts.Message(e.Message)); } return(resp); }
/// <summary> /// Удаляет файл биографии персоны /// </summary> /// <param name="request"></param> /// <returns></returns> public DeletePersonResponse DeleteBiography(DeletePersonRequest request) { if (request == null) { throw new ArgumentNullException("Person model DeletePersonRequest is invalid"); } var resp = new DeletePersonResponse(); try { var unit = factory.CreateUnitOfWork(); var person = unit.Persons.GetItem(request.Id); person.Biography = null; unit.Persons.Update(person); unit.Save(); } catch (Exception e) { resp.AddMessage(new Contracts.Message(e.Message)); } return(resp); }