Example #1
0
 public async Task <ResultDto> RemoveEmailHistoryInfo(int ehID)
 {
     return(new ResultDto()
     {
         Success = await _context.Delete(ehID)
     });
 }
        public ActionResult DeleteConfirmed(int ownerId)
        {
            Owner owner = _ownerRepository.GetOwner(ownerId);

            _ownerRepository.Delete(ownerId);
            _ownerRepository.Save();
            return(RedirectToAction("Index"));
        }
Example #3
0
 public Owner DeleteOwner(int id)
 {
     if (id < 1)
     {
         throw new InvalidOperationException("Id must be bigger than 0");
     }
     return(_ownerRepo.Delete(id));
 }
Example #4
0
        public Owner Delete(int Id)
        {
            if (Id <= 0)
            {
                throw new NullReferenceException("Id cannot be in negative");
            }

            return(_ownerRepository.Delete(Id));
        }
Example #5
0
        public Owner Delete(int id)
        {
            Owner owner = _ownerRepository.ReadById(id);

            if (owner == null)
            {
                throw new NullReferenceException($"The owner with Id: {id} does not exist");
            }
            return(_ownerRepository.Delete(id));
        }
Example #6
0
        public async Task <ActionResult> DeleteOwner(int?id)
        {
            if (id is null)
            {
                throw new NullReferenceException(nameof(id));
            }
            await ownerRepository.Delete((int)id);

            return(RedirectToAction("Index", "Owner"));
        }
Example #7
0
        public AppMutation(IOwnerRepository repository)
        {
            Field <OwnerType>("createOwner",
                              arguments: new QueryArguments(
                                  new QueryArgument <NonNullGraphType <OwnerInputType> > {
                Name = "owner"
            }),
                              resolve: context =>
            {
                var owner = context.GetArgument <Owner>("owner");

                return(repository.Create(owner));
            });


            //update

            Field <OwnerType>(
                "updateOwner",
                arguments: new QueryArguments(
                    new QueryArgument <NonNullGraphType <OwnerInputType> > {
                Name = "owner"
            },
                    new QueryArgument <NonNullGraphType <IdGraphType> > {
                Name = "Id"
            }),
                resolve: context =>
            {
                var owner   = context.GetArgument <Owner>("owner");
                var ownerId = context.GetArgument <Guid>("Id");
                owner.Id    = ownerId;
                return(repository.Update(owner));
            }
                );

            Field <StringGraphType>(
                "deleteOwner",
                arguments: new QueryArguments(new QueryArgument <NonNullGraphType <IdGraphType> > {
                Name = "ownerId"
            }),
                resolve: context =>
            {
                var ownerId = context.GetArgument <Guid>("ownerId");
                // if (ownerId == null)
                //{
                //  context.Errors.Add(new ExecutionError("Owner nao encontrado."));
                // return null;
                // }

                repository.Delete(ownerId);
                return($"Owner id: {ownerId} deletado com sucesso.");
            }
                );
        }
Example #8
0
        public async Task <IActionResult> DeleteOwner(int id)
        {
            Owner owner = await _ownerRepository.FindAsync(id);

            if (owner == null)
            {
                return(NotFound());
            }

            _ownerRepository.Delete(owner);

            return(NoContent());
        }
Example #9
0
        public async Task <string> Delete(string id)
        {
            try
            {
                await productRepository.Delete(id);

                return("OK");
            }
            catch (Exception ex)
            {
                throw new RestException(System.Net.HttpStatusCode.NotFound, ex.Message);
            }
        }
Example #10
0
        public Owner Delete(int id)
        {
            if (id < 1)
            {
                throw new ArgumentException($"Id must be a positive integer.");
            }
            Owner owner = _ownerRepository.Delete(id);

            if (owner is null)
            {
                throw new KeyNotFoundException($"No record with id {id} was found.");
            }
            return(owner);
        }
Example #11
0
        public Owner Delete(int id)
        {
            var ownerToDelete = ReadOwnerById(id);

            if (ownerToDelete == null)
            {
                throw new InvalidDataException("The id is not right");
            }
            else
            {
                _ownerRepo.Delete(ownerToDelete.Id);
                return(ownerToDelete);
            }
        }
        public async Task <Response> Delete(int id)
        {
            try
            {
                Response response = await _OwnerRepo.Delete(id);

                return(response);
            }
            catch (Exception e)
            {
                StringBuilder sb = new StringBuilder();
                log.Error(sb.AppendLine(e.Message).AppendLine(e.StackTrace).ToString());
                Response r = new Response()
                {
                    Success = false
                };
                r.ErrorList.Add("Error on delete Owner");
                return(r);
            }
        }
 public Owner DeleteOwner(int id)
 {
     return(_ownerRepo.Delete(id));
 }
Example #14
0
 public void Delete(Owner owner)
 {
     _ownerRepo.Delete(owner);
 }
Example #15
0
 public void DeleteOwner(int id)
 {
     _ownerRepo.Delete(id);
 }
Example #16
0
 public bool Delete(int Id)
 {
     return(_ownerRepository.Delete(Id));
 }
Example #17
0
 public void Delete(int Id)
 {
     ownerRepository.Delete(Id);
 }
Example #18
0
 public Owner Delete(int id)
 {
     return(_ownerRepository.Delete(id));
 }
Example #19
0
 public Owner Delete(int id)
 {
     return(findOwnerById(id) == null
         ? throw new InvalidDataException("Owner not found or already deleted")
         : _ownerRepository.Delete(id));
 }
Example #20
0
 public Owner Delete(Owner owner)
 {
     return(_ownerRepo.Delete(Owner.Id));
 }
Example #21
0
 public void Delete(int id)
 {
     _ownerRepository.Delete(id);
 }
Example #22
0
 public IActionResult Delete(int id)
 {
     repository.Delete(id);
     return(RedirectToAction("List"));
 }
Example #23
0
 public async Task <bool> DeleteOwnerAsync(long ownerId)
 {
     return(await _ownerRepository.Delete(ownerId));
 }