public IActionResult AddPhoneNumber([FromQuery] string id, string phone) { if (_accountRepo.AddPhoneNumber(id, phone)) { return(Ok(id)); } return(NotFound()); }
public IActionResult AddPhoneNumber([FromBody] PhoneUser phone) { TimeZoneInfo zone = TimeZoneInfo.FindSystemTimeZoneById("SE Asia Standard Time"); DateTime dateTime = TimeZoneInfo.ConvertTime(DateTime.Now, zone); //if success to edit mobile phone if (_accountRepo.AddPhoneNumber(phone.Id_account, phone.Phone)) { Log.Information("Add phone from mobile {name}. {DateTime}.", _dbContext.accounts.FirstOrDefault(x => x.Id_account == phone.Id_account).Name, dateTime); return(Ok(phone.Id_account)); } //if not succes to edit mobile phone Log.Information("Cannot Add phone from mobile {id}, {DateTime}.", phone.Id_account, dateTime); return(NotFound("Cannot Add phone.")); }