public IActionResult AddOrUpdate([FromForm] Wms_inventorymove model, [FromForm] string id) { var validator = new InventoryMoveFluent(); var results = validator.Validate(model); var success = results.IsValid; if (!success) { string msg = results.Errors.Aggregate("", (current, item) => (current + item.ErrorMessage + "</br>")); return(BootJsonH((PubEnum.Failed.ToInt32(), msg))); } if (id.IsEmptyZero()) { model.InventorymoveNo = _serialnumServices.GetSerialnum(UserDtoCache.UserId, "Wms_inventorymove"); model.InventorymoveId = PubId.SnowflakeId; model.Status = StockInStatus.initial.ToByte(); model.CreateBy = UserDtoCache.UserId; bool flag = _inventorymoveServices.Insert(model); return(BootJsonH(flag ? (flag, PubConst.Add1) : (flag, PubConst.Add2))); } else { model.InventorymoveId = id.ToInt64(); model.ModifiedBy = UserDtoCache.UserId; model.ModifiedDate = DateTimeExt.DateTime; var flag = _inventorymoveServices.Update(model); return(BootJsonH(flag ? (flag, PubConst.Update1) : (flag, PubConst.Update2))); } }
public IActionResult Add(string id) { var model = new Wms_inventorymove(); if (id.IsEmpty()) { return(View(model)); } else { model = _inventorymoveServices.QueryableToEntity(c => c.InventorymoveId == SqlFunc.ToInt64(id) && c.IsDel == 1); return(View(model)); } }