Пример #1
0
        public IActionResult Delete(int id)
        {
            _officeRepository.Delete(id);
            _unitOfWork.Commit();

            return(new NoContentResult());
        }
Пример #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));
        }
Пример #3
0
 public Task DeleteAsync(ResourceOrIdentifier <Office, int> input, IRequestContext context, CancellationToken cancellation)
 {
     try
     {
         return(Task.FromResult(_repository.Delete(input.Id)));
     }
     catch (Exception)
     {
         throw;
     }
 }
Пример #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());
        }
Пример #5
0
        public IHttpActionResult DeleteOffice(int id)
        {
            var office = _officeRepository.GetById(id);

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

            _officeRepository.Delete(office);
            return(ApiNoContent());
        }
Пример #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));
            }
        }
Пример #7
0
 public int Delete(Guid[] ids)
 {
     return(_officeRepository.Delete(ids));
 }
Пример #8
0
 public async Task Delete(Office office)
 {
     await officeRepository.Delete(office);
 }