Exemple #1
0
        public HttpResponseMessage Post(FormDataCollection form)
        {
            var values = form.Get("values");

            var sinhVien = new SinhVien();

            JsonConvert.PopulateObject(values, sinhVien);

            if (_sinhVienService.Add(sinhVien))
            {
                return(Request.CreateResponse(HttpStatusCode.Created));
            }

            return(Request.CreateErrorResponse(HttpStatusCode.BadRequest, "Mã sinh viên đã tồn tại"));
        }