public ApiMessage <string> Save(staff user) { if (string.IsNullOrEmpty(user.ID)) { user.ID = Guid.NewGuid().ToString(); user.CreateDate = DateTime.Now; user.Phone = user.Phone; user.PassWord = Encrypt.MD5(user.PassWord); return(_dal.Add(user)); } else { if (user.PassWord.Split('-').Length < 5) { user.PassWord = Encrypt.MD5(user.PassWord); } return(_dal.Edit(user)); } }