public ActionResult ExportExcel(String data) { Response.ContentType = "text/plain"; List<UserInfo> list = JsonConvert.DeserializeObject<List<UserInfo>>(data, dateTimeConverter); UserInfo userinfo = new UserInfo(); //Response.ContentType = "application/vnd.ms-excel;charset=UTF-8"; //Response.AddHeader("Content-Disposition", string.Format("attachment;filename={0}", "temp.xls")); //Response.Clear(); return File(userinfo.Export(list).GetBuffer(), "application/vnd.ms-excel;charset=UTF-8", "data.xls"); }
public ActionResult ModifyUserInfo() { ViewBag.ModifyInfoIsSuccess = false; UserInfo userinfo = new UserInfo(); userinfo = db.UserInfoes.FirstOrDefault<UserInfo>(u => u.Name == User.Identity.Name); ModifyUserInfoViewModel vm = ObjectMapperManager.DefaultInstance.GetMapper<UserInfo, ModifyUserInfoViewModel>().Map(userinfo); return View(vm); }
public ActionResult Edit(UserInfo userinfo) { if (ModelState.IsValid) { db.Entry(userinfo).State = EntityState.Modified; db.SaveChanges(); return RedirectToAction("Index"); } return View(userinfo); }