/// <summary> /// Method that save changes on DbSet<T> /// </summary> public void Save() { try { _ctx.SaveChanges(); } catch (Exception e) { _logger.LogInformation($"Problem with save SET {typeof(T).Name} : {e}"); } }
public void InsertProfile(string firstName, string lastName, string email, string passwordHash, bool isApproved, int genderid, int departmentID, int userTypeID) { Profile c = new Profile(firstName, lastName, email, passwordHash, isApproved); var gender = context.Gender.Find(genderid); c.Gender = gender; var department = context.Departments.Find(departmentID); c.Department = department; var usertype = context.userTypes.Find(userTypeID); c.UserType = usertype; context.Profiles.Add(c); context.SaveChanges(); Profile profile = new Profile(); // var UniqueNo = (from p in context.Profiles where p.ProfileID == p.ProfileID select p.ProfileID).Distinct(); // Console.WriteLine(UniqueNo ); }