public async Task <MessageModel <string> > Post([FromBody] PartyAdvisoryViewModel infos) { var data = new MessageModel <string>(); try { if (infos != null) { var customInfo = _mapper.Map <CustomInfo>(infos); var advisoryInfo = _mapper.Map <PartyAdvisoryInfo>(infos); var cResult = await _customInfoServices.Add(customInfo); advisoryInfo.CustomInfo = cResult; var aResult = await _partyAdvisoryInfoServices.Add(advisoryInfo); if (cResult > 0 && aResult > 0) { data.msg = "添加成功"; data.success = true; data.response = aResult.ObjToString(); } } }catch (Exception ex) { } return(data); }
public async Task <MessageModel <string> > Post([FromBody] CustomInfo custom) { var data = new MessageModel <string>(); custom.CreateTime = DateTime.Now; custom.UpdateTime = DateTime.Now; custom.IsDelete = false; var id = await customInfoServices.Add(custom); data.success = id > 0; if (data.success) { data.response = id.ObjToString(); data.msg = "添加成功"; } return(data); }