Exemplo n.º 1
0
 public CustomerRegistrationModelClass UpdateCustomerDetail(CustomerRegistrationModelClass customer)
 {
     try
     {
         SqlCommand sqlCommand = new SqlCommand("sp_AddCustomerDetails", sqlConnection);
         sqlCommand.CommandType = CommandType.StoredProcedure;
         sqlCommand.Parameters.AddWithValue("@name", customer.Name);
         sqlCommand.Parameters.AddWithValue("@PhoneNumber", customer.PhoneNumber);
         sqlCommand.Parameters.AddWithValue("@Address", customer.Address);
         sqlCommand.Parameters.AddWithValue("@pinCode", customer.PinCode);
         sqlCommand.Parameters.AddWithValue("@Email", customer.Email);
         sqlCommand.Parameters.AddWithValue("@type", customer.Type);
         sqlCommand.Parameters.AddWithValue("@landMark", customer.LandMark);
         sqlCommand.Parameters.AddWithValue("@city", customer.City);
         sqlConnection.Open();
         sqlCommand.ExecuteNonQuery();
         sqlConnection.Close();
         return(customer);
     }
     catch (Exception e)
     {
         throw new Exception("Customer Detail not Added" + e);
     }
     finally
     {
         sqlConnection.Close();
     }
 }
        //[Route("UpdateCustomer")]
        public IActionResult UpdateCustomerDetails(CustomerRegistrationModelClass customer)
        {
            var CustomerResult = this.customerManager.UpdateCustomerDetail(customer);

            try
            {
                if (CustomerResult != null)
                {
                    return(this.Ok(new Response(HttpStatusCode.OK, "The Customer Data", CustomerResult)));
                }
                return(this.NotFound(new Response(HttpStatusCode.NotFound, "customer Data Not Found", CustomerResult)));
            }
            catch (Exception)
            {
                return(this.BadRequest(new Response(HttpStatusCode.BadRequest, "List of customer data not displayed", null)));
            }
        }
        public CustomerRegistrationModelClass UpdateCustomerDetail(CustomerRegistrationModelClass customer)

        {
            return(customerRepository.UpdateCustomerDetail(customer));
        }
 public CustomerRegistrationModelClass AddCustomerDetails(CustomerRegistrationModelClass customer)
 {
     return(customerRepository.AddCustomerDetails(customer));
 }