Example #1
0
        public HttpResponseMessage DeleteParent(string id)
        {
            string userId = ((ClaimsPrincipal)RequestContext.Principal).FindFirst(x => x.Type == "UserId").Value;

            logger.Info("UserId: " + userId + ": Requesting Parent Remove for Parent Id: " + id);

            try
            {
                Parent user = parentsService.Delete(id);

                if (user == null)
                {
                    logger.Info("The Parent with id: " + id + " was not found.");
                    return(Request.CreateResponse(HttpStatusCode.BadRequest, "The Parent with id: " + id + " was not found."));
                }

                logger.Info("Success!");
                return(Request.CreateResponse(HttpStatusCode.OK));
            }
            catch (Exception e)
            {
                logger.Error(e);
                return(Request.CreateErrorResponse(HttpStatusCode.BadRequest, e));
            }
        }