Example #1
0
        public ActionResult Insert([FromBody] ICRUDModel <Units> value)
        {
            if (!ModelState.IsValid) // если проверка не удалась
            {
                var message = string.Join(" | ", ModelState.Values.SelectMany(v => v.Errors).Select(e => e.ErrorMessage));
                BadRequestObjectResult badRequest = new BadRequestObjectResult(HttpStatusCode.BadRequest);
                badRequest.Value = "Ошибка добавление";
            }
            int result = data.Add <Units>(value.value);

            return(Json(value.value));
        }
Example #2
0
        //[ValidateInput(false)]
        public ActionResult CkEditorNews(News item)
        {
            News val = item;

            if (val.Id != 0)
            {
                data.Update <News>(val);
            }
            else
            {
                data.Add <News>(item);
            }
            return(Redirect("/admin/News"));
        }
        public ActionResult Insert([FromBody] ICRUDModel <Products> entity)
        {
            if (!ModelState.IsValid) // если проверка не удалась
            {
                var message = string.Join(" | ", ModelState.Values.SelectMany(v => v.Errors).Select(e => e.ErrorMessage));
                BadRequestObjectResult badRequest = new BadRequestObjectResult(HttpStatusCode.BadRequest);
                badRequest.Value = "Ошибка добавление модели";
            }
            double?Amount = entity.value.Amount;

            entity.value.Amount = null;
            int result = data.Add(entity.value);

            entity.value.Amount = Amount;
            return(Json(entity.value));
        }
        public ActionResult Insert([FromBody] ICRUDModel <Customers> value)
        {
            int result = data.Add <Customers>(value.value);

            return(Json(value.value));
        }
Example #5
0
        public ActionResult Insert([FromBody] ICRUDModel <ProductTypes> value)
        {
            int result = data.Add <ProductTypes>(value.value);

            return(Json(value.value));
        }