public void TestAdd() { var request = new Request <Button>() { Obj = new Button() { Name = "新增", Value = "add", Icon = "icon-add", CreateDate = DateTime.Now, CreateUserId = 1, CreateUserName = "******", Remark = "" } }; new SysLogService().Add(new Request <SysLog>() { Obj = new SysLog() { CreateDate = DateTime.Now, Location = "Test/ButtonService", Action = "TestAdd", Message = JsonConvert.Serialize(request), Type = "添加", UserId = 1, UserName = "******" } }); var response = service.Add(request); Assert.AreEqual(response.Status, 0); }
public ContentResult ButtonAdd(Button model) { HXD.MS.Entity.User user = sessionManager.SessionObject; model.Creater = user.UserName; if (!(buttonService.Add(model) > 0)) { return(Content(AjaxMsgHelper.AjaxMsg(CodeType.Error, "新增失败"))); } return(Content(AjaxMsgHelper.AjaxMsg())); }