예제 #1
0
        public HttpResponseMessage Delete([FromBody] mod.SkillParam skillModel)
        {
            var result   = dbContext.usp_deleteSkills(skillModel.skill.skills, DeCipher.Decrypt(skillModel.key));
            var response = Request.CreateResponse(HttpStatusCode.Accepted);

            response.Content = new StringContent(JsonConvert.SerializeObject(result), Encoding.UTF8, "application/json");
            return(response);
        }
예제 #2
0
        public HttpResponseMessage Put([FromBody] mod.SkillParam skillModel)
        {
            if (!ModelState.IsValid)
            {
                var resposnse = Request.CreateResponse(HttpStatusCode.BadRequest);
                resposnse.Content = new StringContent(JsonConvert.SerializeObject(ModelState), Encoding.UTF8, "application/json");
                return(resposnse);
            }
            string trained  = skillModel.skill.trained == null || skillModel.skill.trained == false ? "No" : "Yes";
            var    response = Request.CreateResponse(HttpStatusCode.OK);
            var    result   = dbContext.usp_updateSkills(skillModel.skill.skills, trained, DeCipher.Decrypt(skillModel.key));

            dbContext.SaveChanges();
            response.Content = new StringContent(JsonConvert.SerializeObject(result), Encoding.UTF8, "application/json");
            return(response);
        }