public long insert(Account entity) { try { entity.CreatedAt = DateTime.Now; entity.Status = true; db.Accounts.Add(entity); db.SaveChanges(); return entity.id; } catch { return -1; } }
public bool update(Account entity) { try { Account a = db.Accounts.Find(entity.id); a.Address = entity.Address; a.Avatar = entity.Avatar; a.DayOfBirth = entity.DayOfBirth; a.Email = entity.Email; a.Facebook = entity.Facebook; a.Fullname = entity.Fullname; a.GroupId = entity.GroupId; a.ModifiedAt = DateTime.Now; a.ModifiedBy = entity.ModifiedBy; a.Password = entity.Password; a.Phone = entity.Phone; a.Roles = entity.Roles; a.Skype = entity.Skype; a.Status = entity.Status; a.Username = entity.Username; a.Yahoo = entity.Yahoo; db.SaveChanges(); return true; } catch { return false; } }