public ActionResult Create(FankuiAddViewModel model) { try { FankuiDto dto = new FankuiDto(); dto.FankuiResult = model.FankuiResult; dto.FankuiSource = model.FankuiSource; dto.FankuiDescription = model.FankuiDescription; dto.FankuiSendTime = System.DateTime.Now; dto.FankuiTime = System.DateTime.Now; dto.FankuiStatus = "已查看"; dto.FankuiCustomerId = model.FankuiCustomerId; dto.FankuiDoctor = int.Parse(System.Web.HttpContext.Current.Request.Cookies["UserId"].Value); // TODO: Add insert logic here string JsonString = JsonHelper.JsonSerializerBySingleData(dto); Message msg = CMSService.Insert("Fankui", JsonString); return RedirectTo("/Fankui/Index/" + model.FankuiCustomerId, msg.MessageInfo); // return RedirectToAction("Index"); } catch { Message msg = new Message(); msg.MessageInfo = "插入操作失败了,请检查是否输入错误"; return RedirectTo("/Fankui/Create/" + model.FankuiCustomerId, msg.MessageInfo); } }
public static FankuiDto getDTO(DataRow dr) { FankuiDto dto = new FankuiDto(); dto.FankuiId = int.Parse(dr["FankuiId"].ToString()); dto.FankuiCustomerId = int.Parse(dr["FankuiCustomerId"].ToString()); dto.FankuiResult = int.Parse(dr["FankuiResult"].ToString()); dto.FankuiDescription = dr["FankuiDescription"].ToString(); dto.FankuiTime = DateTime.Parse(dr["FankuiTime"].ToString()); dto.FankuiSendTime = DateTime.Parse( dr["FankuiSendTime"].ToString()); dto.FankuiSource = int.Parse(dr["FankuiSource"].ToString()); dto.FankuiStatus = dr["FankuiSource"].ToString(); dto.FankuiDoctor = int.Parse(dr["FankuiDoctor"].ToString()); return dto; }