public async Task<IActionResult> Create(GovEntry govEntry, string oids)
		{
			if (ModelState.IsValid)
			{
				var user = await _userManager.GetUserAsync(User);
				var userName = await _userManager.GetUserNameAsync(user);

				govEntry.userName = userName;
				govEntry.collect_time = DateTime.Now;
				govEntry.NameId = _context.List2.First(item => item.name == govEntry.name).nameID;

				_context.Add(govEntry);
				try
				{
					await _context.SaveChangesAsync();
				}
				catch (Exception ex)
				{
					ViewData["ErrMsg"] = "#1 " + ex.Message;
					goto tagReplay;
				}

				var toCheckOids = _context.List2.Where(item => item.name == govEntry.name);
				foreach (var item in toCheckOids)
				{
					if (item.rid == govEntry.ID)
						item.rid = -1;
				}

				if (oids != null)
				{
					var oid_strs = oids.Split(',');
					if (oid_strs.Length != 0)
					{
						foreach (var item in toCheckOids)
							for (int i = 0; i < oid_strs.Length - 1; i++)
							{
								var oid = long.Parse(oid_strs[i]);
								if (item.officerID == oid)
									item.rid = govEntry.ID;
							}
						_context.UpdateRange(toCheckOids);
						try
						{
							await _context.SaveChangesAsync();
						}
						catch (Exception ex)
						{
							ViewData["ErrMsg"] = "#2 " + ex.Message;
							goto tagReplay;
						}
					}
				}

				return RedirectToAction("Index");
			}

			string errMsg = "";
			foreach (var i in ModelState)
			{
				foreach (var item in i.Value.Errors)
				{
					errMsg += i.Key + ": " + item.ErrorMessage + "\n";
				}
			}
			ViewData["ErrMsg"] = errMsg;

			tagReplay:
			ViewData["List2"] = await _context.List2.Where(item => item.name == govEntry.name).ToListAsync();
			ViewData["Title"] = ViewData["Action"] = "Create";
			return View("Basic", govEntry);
		}
		public async Task<IActionResult> Edit(int id, GovEntry govEntry, string oids)
		{
			if (id != govEntry.ID)
			{
				return NotFound();
			}

			var user = await _userManager.GetUserAsync(User);
			var userName = await _userManager.GetUserNameAsync(user);

			if (ModelState.IsValid)
			{
				try
				{
					if (Request.Cookies["EditId"] == null ||
						Request.Cookies["EditId"] !=
						await _userManager.GetSecurityStampAsync(user))
						return NotFound();

					govEntry.userName = userName;
					govEntry.collect_time = DateTime.Now;
					govEntry.NameId = _context.List2.First(item => item.name == govEntry.name).nameID;

					var toCheckOids = _context.List2.Where(item => item.name == govEntry.name);
					foreach (var item in toCheckOids)
					{
						if (item.rid == govEntry.ID)
							item.rid = -1;
					}

					if (oids != null)
					{
						var oid_strs = oids.Split(',');
						if (oid_strs.Length != 0)
						{
							foreach (var item in toCheckOids)
								for (int i = 0; i < oid_strs.Length - 1; i++)
								{
									var oid = long.Parse(oid_strs[i]);
									if (item.officerID == oid)
										item.rid = govEntry.ID;
								}
							_context.UpdateRange(toCheckOids);
						}
					}

					_context.Update(govEntry);
					try
					{
						await _context.SaveChangesAsync();
					}
					catch (Exception ex)
					{
						ViewData["ErrMsg"] = "#3 " + ex.Message;
						goto tagReplay;
					}
				}
				catch (DbUpdateConcurrencyException)
				{
					if (!_context.GovEntry.Any(e => e.ID == govEntry.ID))
					{
						return NotFound();
					}
					else
					{
						throw;
					}
				}
				return RedirectToAction("Index");
			}

			string errMsg = "";
			foreach (var i in ModelState)
			{
				foreach (var item in i.Value.Errors)
				{
					errMsg += i.Key + ": " + item.ErrorMessage + "\n";
				}
			}
			ViewData["ErrMsg"] = errMsg;

			tagReplay:
			ViewData["List2"] = await _context.List2.Where(item => item.name == govEntry.name).ToListAsync();
			ViewData["Title"] = ViewData["Action"] = "Edit";
			return View("Basic", govEntry);
		}