Пример #1
0
        public bool ModifyCollege(ModifyCollegeDTO obj)
        {
            bool res = false;

            obj.ModifiedBy = "1002";
            SqlCommand cmd = new SqlCommand("sp_ModifyCollege");

            cmd.CommandType = CommandType.StoredProcedure;
            cmd.Parameters.AddWithValue("@p_CollegeId", obj.CollegeId);
            cmd.Parameters.AddWithValue("@p_Name", obj.Name);
            cmd.Parameters.AddWithValue("@p_Address", obj.Address);
            cmd.Parameters.AddWithValue("@p_University", obj.University);
            cmd.Parameters.AddWithValue("@p_City", obj.City);
            cmd.Parameters.AddWithValue("@p_State", obj.State);
            cmd.Parameters.AddWithValue("@p_Country", obj.Country);
            cmd.Parameters.AddWithValue("@p_Logo", obj.Logo);
            cmd.Parameters.AddWithValue("@p_CompanyWebsite", obj.CompanyWebSite);
            cmd.Parameters.AddWithValue("@p_ContactNumber", obj.ContactNumber);
            cmd.Parameters.AddWithValue("@p_Email", obj.Email);
            cmd.Parameters.AddWithValue("@p_ActionBy", obj.ModifiedBy);
            int result = new DBlayer().ExecuteNonQuery(cmd);

            if (result != Int32.MaxValue)
            {
                res = true;
            }
            return(res);
        }
 public async Task <IActionResult> CreateSource([FromBody] ModifyCollegeDTO source)
 {
     try
     {
         if (source == null)
         {
             return(BadRequest());
         }
         if (!ModelState.IsValid)
         {
             return(BadRequest("Invalid model object"));
         }
         var sourceEntity = _mapper.Map <College>(source);
         return(Ok(await _repositoryWrapper.CollegeRepo.NewData(sourceEntity)));
     }
     catch (Exception ex)
     {
         //_logger.LogError($"Something went wrong inside CreateSources action: {ex.Message}");
         if (ex.InnerException != null)
         {
             return(BadRequest(ex.Message + "," + ex.InnerException.Message));
         }
         return(BadRequest(ex.Message));
     }
 }
Пример #3
0
        public HttpResponseMessage ModifyCollege(ModifyCollegeDTO obj)
        {
            HttpResponseMessage message;

            try
            {
                CollegeDAL dal    = new CollegeDAL();
                var        dynobj = new { result = dal.ModifyCollege(obj) };
                message = Request.CreateResponse(HttpStatusCode.OK, dynobj);
            }
            catch (Exception ex)
            {
                message = Request.CreateResponse(HttpStatusCode.BadRequest, new { msgText = "something Wrong.Try Again!" });
            }
            return(message);
        }