public async Task <IActionResult> ModifyIdeaWeightForm([FromBody] ModifyIdeaWeightInput input) { var entity = await _patientApp.GetForm(input.Pid); if (entity == null) { return(Success("操作成功。")); } entity.F_IdealWeight = input.IdeaWeight; await _patientApp.UpdateForm(entity); return(Success("操作成功。")); }
public async Task <IActionResult> UploadImage(IFormFile file, string id) { var targetPath = Path.Combine(AppConsts.AppRootPath, "upload", "patient"); var targetHeadIconPath = Path.Combine(targetPath, "headIcon"); FileHelper.CreateDirectory(targetPath); FileHelper.CreateDirectory(targetHeadIconPath); var serialNo = Common.CreateNo(); var fileName = Path.Combine(targetPath, serialNo + Path.GetExtension(file.FileName)); using (var stream = new FileStream(fileName, FileMode.Create)) { await file.CopyToAsync(stream); stream.Flush(); } var headFileName = Path.Combine(targetHeadIconPath, serialNo + Path.GetExtension(file.FileName)); Ext.CutForSquare(fileName, headFileName, 400, 90); if (!id.IsEmpty()) { var entity = await _patientApp.GetForm(id); if (entity != null) { entity.F_HeadIcon = headFileName.Replace(AppConsts.AppRootPath, ""); await _patientApp.UpdateForm(entity); } } return(Ok("操作成功")); }