Example #1
0
        public HttpResponseMessage Delete(int id)
        {
            HttpResponseMessage response;
            ModelsValidation    validation = new ModelsValidation();
            VariantData         data       = new VariantData();

            if (validation.DoesVariantExist(id) == false)
            {
                response = Request.CreateResponse(HttpStatusCode.NotFound, new { Message = "There is no variant with given Id parameter." });
            }
            else
            {
                try
                {
                    data.DeleteVariantById(id);
                    response = Request.CreateResponse(HttpStatusCode.NoContent);
                }
                catch (SqlException sqlException)
                {
                    response = CheckSqlExceptionNumber(sqlException.Number);
                }
            }

            return(response);
        }