public int AddCustomer(Customer cust)
        {
            string currId = db.Customer.Max(m => m.CustomerId);
            int    curr   = Convert.ToInt32(currId) + 1;

            cust.CustomerId = Convert.ToString(curr);
            db.Customer.Add(cust);
            db.SaveChanges();
            return(1);
        }
Ejemplo n.º 2
0
        public int SaveEmployee(EmployeeModel model)
        {
            var newEmployee = new Employees
            {
                Name     = model.Name,
                Location = model.Location,
                Salary   = model.Salary
            };

            _context.Employees.Add(newEmployee);
            _context.SaveChanges();

            return(newEmployee.Id);
        }