public static Entities.Users Map(PizzaBox_Lib.Models.Users users) { return(new Entities.Users() { Id = users.Id, Username = users.Username, Pass = users.Pass, IsEmployee = users.IsEmployee, //Orders = Map(users.Orders) }); }
public void AddUser(PizzaBox_Lib.Models.Users users) { if (db.Users.Any(u => u.Username == users.Username) || users.Username == null) { Console.WriteLine($"A user with username '{users.Username}' already exists and cannot be added"); return; } else { db.Users.Add(Mapper.Map(users)); db.SaveChanges(); } }