Beispiel #1
0
        public HttpResponseMessage UpdateEarthWatcher(Earthwatcher ew, HttpRequestMessage <Earthwatcher> request)
        {
            if (ew.MailChanged == true && ew.Name != null)
            {
                bool exists = earthwatcherRepository.EarthwatcherExists(ew.Name);
                if (exists == true)
                {
                    return(new HttpResponseMessage {
                        StatusCode = HttpStatusCode.MultipleChoices
                    });
                }
            }

            if (ew != null)
            {
                earthwatcherRepository.UpdateEarthwatcher(ew.Id, ew);
                return(new HttpResponseMessage {
                    StatusCode = HttpStatusCode.OK
                });
            }
            return(new HttpResponseMessage {
                StatusCode = HttpStatusCode.NotFound
            });
        }