/// <summary> /// Updates ONE single User (PUT) /// </summary> /// <param name="userId"></param> /// <returns></returns> public void UpdateUser(int userId) { UserViewModel item; DAL objDAL = new DAL(); string querySql = $"update clients set " + $"Name = '{Username.ToString()}'," + $"Password = '******'," + $"Email = '{Email.ToString()}'," + $"CreatedAt = '{DateTime.Parse(CreatedAt.ToString()).ToString("yyyy/MM/dd")}'," + $"LastOrder = '{DateTime.Parse(LastOrder.ToString()).ToString("yyyy/MM/dd")}'," + $"UrlImg = '{UrlImg.ToString()}'," + $"Phone = '{Phone.ToString()}' " + $"where UserId = {userId.ToString()}"; objDAL.ExecutaComandoSQL(querySql); }
//public virtual OrderViewModel Order { get; set; } #endregion #region HTTP Methods (GET/POST/PUT/DELETE) /// <summary> /// Registrar um novo usuário (POST) /// </summary> public void RegisterUser() { DAL objDAL = new DAL(); //$ -> interpolação de strings string stringSql = $"insert into clients (" + $" Name," + $" Password," + $" Email," + $" CreatedAt," + $" LastOrder," + $" UrlImg," + $" Phone)" + $"values (" + $"'{Username}'," + $"'{Password}'," + $"'{Email}'," + $"'{DateTime.Parse(CreatedAt.ToString()).ToString("yyyy/MM/dd")}'," + $"'{DateTime.Parse(LastOrder.ToString()).ToString("yyyy/MM/dd")}'," + $"'{UrlImg}'," + $"'{Phone}') "; objDAL.ExecutaComandoSQL(stringSql); }