Пример #1
0
 public ActionResult CreateMaterial(MaterialCreateViewModel model)
 {
     if (ModelState.IsValid)
     {
         IMaterialService materialSvc = new MaterialService();
         materialSvc.CreateMaterial(model.Code, model.LargyCategory, model.SmallCategory, model.Describe, model.Unit, model.Note);
         return(RedirectToAction(nameof(MaterialList)));
     }
     ModelState.AddModelError("", @"您录入的信息有误");
     return(View());
 }
Пример #2
0
        public string NewMaterial([FromForm] NewMaterialDTO fileInfo, [FromForm] IFormFile file)
        {
            try
            {
                byte[] bytes;
                using (var stream = new MemoryStream())
                {
                    file.CopyTo(stream);
                    bytes = stream.ToArray();
                }
                fileInfo.fileBlob = bytes;
                _materialService.CreateMaterial(fileInfo);

                return("Ok");
            }
            catch (Exception e)
            {
                return("NotOk");
            }
        }
Пример #3
0
 public static void CreateMaterialList(string organizationId, string name)
 {
     MaterialService.CreateMaterial(organizationId, name);
 }