public ActionResult Edit(int id, UserInfo userInfo) { try { // TODO: Add update logic here var temp=userInfoService.Load(u => u.Id == id).FirstOrDefault(); temp.UserName = userInfo.UserName; temp.Email = userInfo.Email; temp.Remark = userInfo.Remark; userInfoService.Modified(temp); return RedirectToAction("Index"); } catch { return View(); } }
public void Add() { UserInfoService userInfoService=new UserInfoService(); UserInfo userInfo = new UserInfo() { DeleteFlag = 1,Email = "*****@*****.**", LoginCode = "ypf", ModifiedDateTime = DateTime.Now, Password = "******" , Remark = "test data", SubmitDateTime = DateTime.Now, UserName = "******", UserStatus = 1 }; Assert.AreEqual(true, userInfoService.Add(userInfo)); }
public ActionResult Create(UserInfo userInfo) { try { // TODO: Add insert logic here userInfo.DeleteFlag = 1; userInfo.LoginCode = "ypftest"; userInfo.ModifiedDateTime=DateTime.Now; userInfo.Password = "******"; userInfo.Remark = "提交数据"; userInfo.SubmitDateTime=DateTime.Now; userInfo.UserStatus = 1; userInfoService.Add(userInfo); return RedirectToAction("Index"); } catch { return View(); } }
public ActionResult Delete(int id, UserInfo userInfo ) { try { // TODO: Add delete logic here userInfo.Id = id; userInfoService.Delete(userInfo); return RedirectToAction("Index"); } catch { return View(); } }