public byte Insert(UserTypeModelClass ModelClass) { byte maxId = db.UserTypes.Max(x => x.UserTypeId); ModelClass.UserTypeId = Convert.ToByte(maxId + 1); db.Entry(ModelClass); db.SaveChanges(); return(ModelClass.UserTypeId); }
public void Delete(UserTypeModelClass ModelClass) { try { db.Entry(ModelClass).State = System.Data.Entity.EntityState.Deleted; db.SaveChanges(); } catch (Exception ex) { throw ex; } }