public async Task <Result> AddData(int attributeId, [FromBody] ProductAttributeDataParam model) { var data = new ProductAttributeData { AttributeId = attributeId, IsPublished = model.IsPublished, Value = model.Value, Description = model.Description }; _productAttrDataRepository.Add(data); await _productAttrDataRepository.SaveChangesAsync(); return(Result.Ok()); }
public async Task <Result> EditData(int id, [FromBody] ProductAttributeDataParam model) { var data = await _productAttrDataRepository.FirstOrDefaultAsync(id); if (data == null) { return(Result.Fail("单据不存在")); } data.IsPublished = model.IsPublished; data.Value = model.Value; data.Description = model.Description; data.UpdatedOn = DateTime.Now; await _productAttrDataRepository.SaveChangesAsync(); return(Result.Ok()); }