public JsonResult Add(DianZanLogVModel model) { var result = new JsonResultModel(); if (ModelState.IsValid) { //add result.ResultState = DianZanLogs.AddDianZanLog(DianZanLogs.DianZanLogVModelToInfo(model)) > 0; } else { result.ResultState = false; result.Message = ModelStateHelper.GetAllErrorMessage(ModelState); } return(Json(result)); }
/// <summary> /// ViewModel 转 DataModel /// </summary> /// <param name="dianzanlog"></param> /// <returns></returns> public static DianZanLogInfo DianZanLogVModelToInfo(DianZanLogVModel dianzanlog) { if (dianzanlog == null) { return(new DianZanLogInfo()); } return(new DianZanLogInfo { Id = dianzanlog.Id, MId = dianzanlog.MId, CId = dianzanlog.CId, UserId = dianzanlog.UserId, Ip = dianzanlog.Ip, IsCancel = dianzanlog.IsCancel, CancelTime = dianzanlog.CancelTime, Type = dianzanlog.Type, CreateTime = dianzanlog.CreateTime }); }
public ActionResult Add() { var vm = new DianZanLogVModel(); return(View(vm)); }
/// <summary> /// 添加点赞记录 /// </summary> /// <param name="model"></param> /// <returns></returns> public long Add(DianZanLogVModel model) { return(HGShare.Business.DianZanLogs.AddDianZanLog(HGShare.Business.DianZanLogs.DianZanLogVModelToInfo(model))); }