public HttpResponseMessage CreateClassfication(AddClassificationDTO classfication) { HttpResponseMessage message; try { // CustomerSiteMappingDataAccessLayer dal = new CustomerSiteMappingDataAccessLayer(); var dynObj = new { result = _Customermapping.InsertClassfication(classfication) }; message = Request.CreateResponse(HttpStatusCode.OK, dynObj); } catch (Exception ex) { message = Request.CreateResponse(HttpStatusCode.BadRequest, new { msgText = "Something wrong. Try Again!" }); ErrorLog.CreateErrorMessage(ex, "CustomerSiteMapping", "CreateClassfication"); } return(message); }
public bool InsertClassfication(AddClassificationDTO objClassfication) { bool res = false; SqlCommand SqlCmd = new SqlCommand("spInsertCustomerSiteMapping"); SqlCmd.CommandType = CommandType.StoredProcedure; SqlCmd.Parameters.AddWithValue("@CustomerId", objClassfication.CustomerId); SqlCmd.Parameters.AddWithValue("@BranchId", objClassfication.BranchId); SqlCmd.Parameters.AddWithValue("@SiteId", objClassfication.SiteId); SqlCmd.Parameters.AddWithValue("@Classification", objClassfication.Classfication); SqlCmd.Parameters.AddWithValue("@CreatedBy", objClassfication.CreatedBy); int result = _unitOfWork.DbLayer.ExecuteNonQuery(SqlCmd); if (result != Int32.MaxValue) { res = true; } return(res); }