public static void Create(string userName, string applicationPage, int operationId, string result) { using (var db = new SmizeeContext()) { Audit entity = new Audit(); entity.UserName = userName; entity.ApplicationPage = applicationPage; entity.OperationID = operationId; entity.Timestamp = DateTime.Now; entity.Result = result; db.Audits.Add(entity); db.SaveChanges(); } }
public static MembershipCreateStatus Register(string Username, string Password, string Email, bool IsApproved, string FirstName, string LastName, int?companyId) { MembershipCreateStatus CreateStatus; MembershipUser user = Membership.CreateUser(Username, Password, Email, null, null, IsApproved, Guid.NewGuid(), out CreateStatus); if (CreateStatus == MembershipCreateStatus.Success) { using (SmizeeContext Context = new SmizeeContext()) { User User = Context.Users.FirstOrDefault(Usr => Usr.Username == Username); User.CompanyID = companyId; User.FirstName = FirstName; User.LastName = LastName; Context.SaveChanges(); } } return(CreateStatus); }