Example #1
0
        public IActionResult Delete(int id)
        {
            _officeRepository.Delete(id);
            _unitOfWork.Commit();

            return(new NoContentResult());
        }
Example #2
0
        public ModelResponse Delete(UserInfo user, long id, string reason)
        {
            try
            {
                //Authorization
                if (user == null)
                {
                    return(new ModelResponse(101));
                }
                if (!user.IsApproved || user.IsIndividual || user.OrgContactId == null)
                {
                    return(new ModelResponse(101));
                }

                var isAdmin = DalFactory.Singleton.DataService.IsAdmin(user.UserId);
                if (!isAdmin)
                {
                    return(new ModelResponse(101));
                }

                Repo.Delete(id, user.UserId, reason);
            }
            catch (Exception ex)
            {
                return(new ModelResponse(ex));
            }

            return(new ModelResponse(0));
        }
Example #3
0
 public Task DeleteAsync(ResourceOrIdentifier <Office, int> input, IRequestContext context, CancellationToken cancellation)
 {
     try
     {
         return(Task.FromResult(_repository.Delete(input.Id)));
     }
     catch (Exception)
     {
         throw;
     }
 }
Example #4
0
        public IActionResult Delete(int id)
        {
            var todelete = _repository.Get(id);

            if (todelete != null)
            {
                _repository.Delete(todelete);
                return(Helper.CheckResult(todelete, true));
            }
            return(NotFound());
        }
Example #5
0
        public IHttpActionResult DeleteOffice(int id)
        {
            var office = _officeRepository.GetById(id);

            if (office == null)
            {
                return(ApiNotFound());
            }

            _officeRepository.Delete(office);
            return(ApiNoContent());
        }
Example #6
0
        public async Task <IActionResult> DeleteOffice(int id)
        {
            try
            {
                var office = await _officeRepository.FindById(id);

                await _officeRepository.Delete(office);

                return(Ok());
            }
            catch (ArgumentException e)
            {
                return(Conflict(e.Message));
            }
            catch (InvalidOperationException)
            {
                return(NotFound());
            }
            catch (DbUpdateException e)
            {
                return(Conflict(e.Message));
            }
        }
Example #7
0
 public int Delete(Guid[] ids)
 {
     return(_officeRepository.Delete(ids));
 }
Example #8
0
 public async Task Delete(Office office)
 {
     await officeRepository.Delete(office);
 }