apikey.creationdate

This commit is contained in:
Paul Schneider 2021-05-09 01:52:46 +01:00
commit bb02706773
5 changed files with 47 additions and 10 deletions

View file

@ -1,3 +1,4 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Security.Claims;
@ -66,7 +67,8 @@ namespace nuget_host.Controllers
ModelState.AddModelError(null, "Maximum key count reached");
return View();
}
ApiKey newKey = new ApiKey { UserId = userid, Name = model.Name };
ApiKey newKey = new ApiKey { UserId = userid, Name = model.Name,
CreationDate = DateTime.Now };
_ = dbContext.ApiKeys.Add(newKey);
_ = await dbContext.SaveChangesAsync();
return View("Details", new DetailModel { Name = newKey.Name,