public async Task <long> AddAsync(UserAccessLogVModel model) { return (await HGShare.Business.UserAccessLogs.AddUserAccessLogAsync( HGShare.Business.UserAccessLogs.UserAccessLogVModelToInfo(model))); }
public JsonResult Add(UserAccessLogVModel model) { var result = new JsonResultModel(); if (ModelState.IsValid) { //add result.ResultState = UserAccessLogs.AddUserAccessLog(UserAccessLogs.UserAccessLogVModelToInfo(model)) > 0; } else { result.ResultState = false; result.Message = ModelStateHelper.GetAllErrorMessage(ModelState); } return(Json(result)); }
/// <summary> /// ViewModel 转 DataModel /// </summary> /// <param name="useraccesslog"></param> /// <returns></returns> public static UserAccessLogInfo UserAccessLogVModelToInfo(UserAccessLogVModel useraccesslog) { if (useraccesslog == null) { return(new UserAccessLogInfo()); } return(new UserAccessLogInfo { Id = useraccesslog.Id, Url = useraccesslog.Url, Referer = useraccesslog.Referer, UserAgent = useraccesslog.UserAgent, UserId = useraccesslog.UserId, Ip = useraccesslog.Ip, InsertTime = useraccesslog.InsertTime, Other = useraccesslog.Other, Type = useraccesslog.Type }); }
public ActionResult Add() { var vm = new UserAccessLogVModel(); return(View(vm)); }