예제 #1
0
        public async Task <IActionResult> Delete(Guid id, DeleteAuthor command)
        {
            command.Id = id;

            await Dispatcher.SendAsync(command);

            return(NoContent());
        }
		public BLResponse<Author> DeleteAuthor(DeleteAuthor author, BLRequest blRequest){

			Client.Execute(proxy=>{
				Authors.Destroy(proxy, author.Id);
			});

			var r = new BLResponse<Author>();
			if(IsCayita(blRequest)) 
				r.Html= "record deleted";
			return r;
		}
 public Task Handle(object command)
 {
     return(command switch
     {
         Create cmd => HandleCreate(cmd),
         Update cmd => HandleFullUpdate(cmd),
         SetAuthorsFirstName cmd => HandleUpdate(cmd.Id, (a) => a.SetFirstName(cmd.FirstName),
                                                 (a) => Repository.Update(a)),
         SetAuthorsLastName cmd => HandleUpdate(cmd.Id, (a) => a.SetLastName(cmd.LastName),
                                                (a) => Repository.Update(a)),
         SetAuthorDateOfBirth cmd => HandleUpdate(cmd.Id, (a) => a.SetDateOfBirth(cmd.DataOfBirth),
                                                  (a) => Repository.Update(a)),
         SetMugshotPath cmd => HandleUpdate(cmd.Id, (a) => a.SetMugshotPath(cmd.MugshotPath),
                                            (a) => Repository.Update(a)),
         SetBiography cmd => HandleUpdate(cmd.Id, (a) => a.SetBiography(cmd.Biography),
                                          (a) => Repository.Update(a)),
         SetNotesOld cmd => HandleUpdate(cmd.Id, (a) => a.SetNotesOld(cmd.NotesOld),
                                         (a) => Repository.Update(a)),
         SetNationality cmd => HandleUpdateAsync(cmd.Id,
                                                 async a => await UpdateNationalityAsync(a, cmd.NationalityId)),
         DeleteAuthor cmd => HandleUpdate(cmd.Id, _ => Repository.RemoveAsync(cmd.Id)),
         _ => Task.CompletedTask
     });
예제 #4
0
		public BLResponse<Author> Any(DeleteAuthor request)
		{
			return Controller.DeleteAuthor(request, BLRequest);
		}