public JsonResult Add(NotifyVModel model) { var result = new JsonResultModel(); if (ModelState.IsValid) { //add result.ResultState = Notifys.AddNotify(Notifys.NotifyVModelToInfo(model)) > 0; } else { result.ResultState = false; result.Message = ModelStateHelper.GetAllErrorMessage(ModelState); } return(Json(result)); }
/// <summary> /// ViewModel 转 DataModel /// </summary> /// <param name="notify"></param> /// <returns></returns> public static NotifyInfo NotifyVModelToInfo(NotifyVModel notify) { if (notify == null) { return(new NotifyInfo()); } return(new NotifyInfo { Id = notify.Id, FromUserId = notify.FromUserId, ToUserId = notify.ToUserId, CreateTime = notify.CreateTime, IsDelete = notify.IsDelete, IsRead = notify.IsRead, IsSystem = notify.IsSystem, Content = notify.Content, Title = notify.Title }); }
public ActionResult Add() { var vm = new NotifyVModel(); return(View(vm)); }