예제 #1
0
        public async Task <IHttpActionResult> DeleteLocation(DeleteLocationRequest deleteLocationRequest)
        {
            try
            {
                if (!ModelState.IsValid)
                {
                    return(BadRequest(ModelState));
                }

                var geolocationToDelete = await _geolocationRepository.GetGeolocationByGuid(deleteLocationRequest.Id);

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

                var success = await _geolocationRepository.DeleteGeolocation(deleteLocationRequest.Id);

                if (!success)
                {
                    return(InternalServerError());
                }

                return(Content((HttpStatusCode)204, string.Empty));
            }
            catch (Exception ex)
            {
                _logger.Error("DeleteLocation error " + ex.Message, ex);
                return(InternalServerError(new Exception("Check server logs")));
            }
        }
예제 #2
0
 public async Task <ResponseDTO> Delete(DeleteLocationRequest location)
 {
     if (ModelState.IsValid)
     {
         return(await _locationApplicationService.DeleteLocationAsync(location));
     }
     return(ModelState.ToResponse());
 }
예제 #3
0
        public async Task <ResponseDTO> DeleteLocationAsync(DeleteLocationRequest location)
        {
            //Map to Command
            var command = _mapper.Map <DeleteLocationRequest, DeleteLocationCommand>(location);

            //Execute Command
            var resp = await _bus.SendAsync(command);

            return(ResponseBuilder.Correct(resp));
        }
예제 #4
0
 public void Deletelocation(DeleteLocationRequest argObj)
 {
     try
     {
         AdminDAL ws = new AdminDAL();
         ws.DeleteLocationUser(argObj);
     }
     catch (Exception ex)
     {
     }
 }
예제 #5
0
 public DeleteLocationResponse DeleteLocation(DeleteLocationRequest request)
 {
     try
     {
         ILocationBroker broker = PersistenceContext.GetBroker <ILocationBroker>();
         Location        item   = broker.Load(request.LocationRef, EntityLoadFlags.Proxy);
         broker.Delete(item);
         PersistenceContext.SynchState();
         return(new DeleteLocationResponse());
     }
     catch (PersistenceException)
     {
         throw new RequestValidationException(string.Format(SR.ExceptionFailedToDelete, TerminologyTranslator.Translate(typeof(Location))));
     }
 }
예제 #6
0
 public SuccessResponse Delete(DeleteLocationRequest request)
 {
     try
     {
         var location = _locationRepository.FindBy(request.Id);
         location.ThrowExceptionIfRecordIsNull();
         _locationRepository.Remove(location);
         return(new SuccessResponse {
             IsSuccess = true
         });
     }
     catch (DataAccessException)
     {
         throw new ApplicationException();
     }
 }
        public async Task DeleteLocation_Call()
        {
            //--------------    Arrange     -------------
            CommonArrangements();

            var request = new DeleteLocationRequest();
            var command = new DeleteLocationCommand();

            A.CallTo(() => mapper.Map <DeleteLocationRequest, DeleteLocationCommand>(request)).Returns(command);


            //--------------    Act     -------------
            var resp = locationService.DeleteLocationAsync(request);

            //--------------    Assert     -------------

            A.CallTo(() => bus.SendAsync(command)).MustHaveHappened(Repeated.Exactly.Once);
        }
예제 #8
0
        private void DeleteItem(string arglocationid)
        {
            log4net.ILog logger = log4net.LogManager.GetLogger("File");
            try
            {
                if (!string.IsNullOrEmpty(arglocationid))
                {
                    AdminBLL ws = new AdminBLL();
                    DeleteLocationRequest _req = new DeleteLocationRequest();

                    _req.locid = arglocationid.ToString();

                    ws.Deletelocation(_req);
                    HttpContext.Current.Items.Add(ContextKeys.CTX_COMPLETE, "DELETE");
                    Server.Transfer("AlertUpdateComplete.aspx");
                }
            }
            catch (Exception ex)
            {
                logger.Info(ex.Message);
            }
        }
예제 #9
0
 public SuccessResponse Delete(DeleteLocationRequest request)
 {
     return(_locationService.Delete(request));
 }