Esempio n. 1
0
        public HttpResponseMessage Post(GadgetPostData data)
        {
            try
            {
                if (!_repository.GadgetLinkExists(data.GadgetId, data.AreaType, data.RoleId))
                {
                    var g = _repository.AddGadgetLink(data.GadgetId, data.AreaType, data.RoleId);

                    return(Request.CreateResponse(HttpStatusCode.OK, g));
                }

                return(Request.CreateResponse(HttpStatusCode.Conflict));
            }
            catch (Exception ex)
            {
                return(Request.CreateErrorResponse(HttpStatusCode.BadRequest, ex));
            }
        }