Ejemplo n.º 1
0
 public void UpdateCrew(ModelHairdresserCrew model)
 {
     try
     {
         using (SqlConnection connection = new SqlConnection(ConnectionString))
         {
             using (SqlCommand command = connection.CreateCommand())
             {
                 connection.Open();
                 command.CommandText = "SP_UpdateHairdressingCrew";
                 command.CommandType = CommandType.StoredProcedure;
                 command.Parameters.AddWithValue("Id", model.Id);
                 command.Parameters.AddWithValue("Name", model.Name);
                 command.Parameters.AddWithValue("Address", model.Address);
                 command.Parameters.AddWithValue("Phone", model.Phone);
                 command.Parameters.AddWithValue("Email", model.Email);
                 command.ExecuteNonQuery();
             }
         }
     }
     catch (Exception)
     {
         throw;
     }
 }
Ejemplo n.º 2
0
        public ActionResult UpdateCrew(int UpdId, string UpdName, string UpdAddress, int UpdPhone, string UpdEmail)
        {
            DalHairdresserCrew   Crew = new DalHairdresserCrew();
            ModelHairdresserCrew ModelHairdresserCrew = new ModelHairdresserCrew(UpdId, UpdName, UpdAddress, UpdPhone, UpdEmail);

            Crew.UpdateCrew(ModelHairdresserCrew);
            return(RedirectToAction("Crew"));
        }
Ejemplo n.º 3
0
        public ActionResult InsertCrew(string InsName, string InsAddress, int InsPhone, string InsEmail)
        {
            DalHairdresserCrew   Crew = new DalHairdresserCrew();
            ModelHairdresserCrew ModelHairdresserCrew = new ModelHairdresserCrew(InsName, InsAddress, InsPhone, InsEmail);

            Crew.InsetCrew(ModelHairdresserCrew);
            return(RedirectToAction("Crew"));
        }
Ejemplo n.º 4
0
        public List <ModelHairdresserCrew> SearchId(int Id)
        {
            try
            {
                List <ModelHairdresserCrew> ReturnList = new List <ModelHairdresserCrew>();
                using (SqlConnection connection = new SqlConnection(ConnectionString))
                {
                    using (SqlCommand command = connection.CreateCommand())
                    {
                        connection.Open();
                        command.CommandText = "SP_ListHairdressingCrewId";
                        command.CommandType = CommandType.StoredProcedure;
                        command.Parameters.AddWithValue("Id", Id);
                        SqlDataReader reader = command.ExecuteReader();

                        while (reader.Read())
                        {
                            ModelHairdresserCrew crew = new ModelHairdresserCrew()
                            {
                                Id      = Convert.ToInt32(reader["Id"]),
                                Name    = reader["Name"].ToString(),
                                Address = reader["Address"].ToString(),
                                Phone   = Convert.ToInt32(reader["Phone"]),
                                Email   = reader["Email"].ToString()
                            };
                            ReturnList.Add(crew);
                        }
                    }
                }
                return(ReturnList);
            }
            catch (Exception)
            {
                throw;
            }
        }