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()); }
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"); } }
public static void CreateMaterialList(string organizationId, string name) { MaterialService.CreateMaterial(organizationId, name); }