Ejemplo n.º 1
0
        /// <summary>
        /// It Stores Data into the Database
        /// </summary>
        /// <param name="makerProgram">MakerProgram</param>
        /// <returns>If Data Added Successfully return ResponseData else null or Exception</returns>
        public MakerProgramResponse AddMakerProgram(MakerProgramRequest makerProgram)
        {
            try
            {
                MakerProgramResponse responseData = null;
                using (SqlConnection conn = new SqlConnection(sqlConnectionString))
                {
                    SqlCommand cmd = new SqlCommand("spAddMakerProgram", conn)
                    {
                        CommandType = System.Data.CommandType.StoredProcedure
                    };
                    cmd.Parameters.AddWithValue("@ProgramName", makerProgram.ProgramName);
                    cmd.Parameters.AddWithValue("@ProgramType", makerProgram.ProgramType);
                    cmd.Parameters.AddWithValue("@ProgramLink", makerProgram.ProgramLink);
                    cmd.Parameters.AddWithValue("@TechStackID", makerProgram.TechStackID);
                    cmd.Parameters.AddWithValue("@TechTypeID", makerProgram.TechTypeID);
                    cmd.Parameters.AddWithValue("@IsprogramApproved", makerProgram.IsProgramApproved);
                    cmd.Parameters.AddWithValue("@DescriptionStatus", makerProgram.DescriptionStatus);
                    cmd.Parameters.AddWithValue("@CreatorStamp", makerProgram.CreatorStamp);
                    cmd.Parameters.AddWithValue("@CreatorUser", makerProgram.CreatorUser);
                    cmd.Parameters.AddWithValue("@CreatedDate", DateTime.Now);
                    cmd.Parameters.AddWithValue("@ModifiedDate", DateTime.Now);

                    conn.Open();
                    SqlDataReader dataReader = cmd.ExecuteReader();
                    while (dataReader.Read())
                    {
                        responseData = new MakerProgramResponse
                        {
                            ID                = Convert.ToInt32(dataReader["MakerProgramID"]),
                            ProgramName       = dataReader["ProgramName"].ToString(),
                            ProgramType       = dataReader["ProgramType"].ToString(),
                            ProgramLink       = dataReader["ProgramLink"].ToString(),
                            TechStackID       = Convert.ToInt32(dataReader["TechStackID"]),
                            TechTypeID        = Convert.ToInt32(dataReader["TechTypeID"]),
                            IsProgramApproved = Convert.ToBoolean(dataReader["IsProgramApproved"]),
                            DescriptionStatus = dataReader["DescriptionStatus"].ToString(),
                            CreatorStamp      = dataReader["CreatorStamp"].ToString(),
                            CreatorUser       = dataReader["CreatorUser"].ToString(),
                            CreatedDate       = Convert.ToDateTime(dataReader["CreatedDate"]),
                            ModifiedDate      = Convert.ToDateTime(dataReader["ModifiedDate"])
                        };
                    }
                    conn.Close();
                }
                return(responseData);
            }
            catch (Exception ex)
            {
                throw new Exception(ex.Message);
            }
        }
Ejemplo n.º 2
0
 public IActionResult MakerProgram(MakerProgramRequest makerProgram)
 {
     try
     {
         bool   success = false;
         string message;
         var    data = _makerBusiness.AddMakerProgram(makerProgram);
         if (data != null)
         {
             success = true;
             message = "Maker Program Added Successfully";
             return(Ok(new { success, message, data }));
         }
         else
         {
             message = "Try Again!";
             return(NotFound(new { success, message }));
         }
     }
     catch (Exception ex)
     {
         return(BadRequest(new { ex.Message }));
     }
 }
Ejemplo n.º 3
0
        public MakerProgramResponse AddMakerProgram(MakerProgramRequest makerProgram)
        {
            var responseData = _makerRepository.AddMakerProgram(makerProgram);

            return(responseData);
        }