Exemple #1
0
        public HttpResponseMessage DeleteObservation(int id)
        {
            if (Request.Method == HttpMethod.Options)
            {
                return new HttpResponseMessage()
                       {
                           StatusCode = HttpStatusCode.OK
                       }
            }
            ;

            if (loggedUserId == null)
            {
                //TODO: you are not logged message here
                return(Request.CreateResponse(HttpStatusCode.Unauthorized, "err niezalogowany"));
            }

            if (_observationRepository.GetObservationOwnerId(id).FirstOrDefault() != loggedUserId)
            {
                return(Request.CreateResponse(HttpStatusCode.OK, "err nie twoja obserwacja"));
            }

            var observation = _observationRepository.GetObservation(id).FirstOrDefault();

            var result = _observationRepository.DeleteObservation(id);

            return(Request.CreateResponse(HttpStatusCode.OK, "success obsewacja usunieta"));
        }
    }
 public void DeleteObservation(Observation observation)
 {
     repository.DeleteObservation(observation);
 }